I have gridview like picture below.
I need to freeze header of my gridview and a cell. When I scroll the page vertically, the header's position fix on top. When I scroll horizontally, the specific column freeze and become the first column like below
How can I do that?
Simplest solution: create a duplicate copy of the the grid, lets call it grid2.
Right after setting the datasource of the original grid, set the datasource of grid2 to originalgrid.Rows[0]; then bind the grid2
grid2.dataSource = OriginalGrid.Rows[0]
grid2.Bind()
Related
I have a TableView where I add a new row by right clicking on the row below where I want to place the row and choosing "add" in a context menu. This becomes a problem when the TableView has so many rows that the entire view is filled with filled rows, since no empty rows are displayed. When this happens, I can only add a row above the row at the bottom, but not below it.
Adding a "dummy item" to the bottom of the TableView when that is used is not an option. I need to add a TableRow that has a item that is null, like the rows that usually fill out the viewport of the TableView when there's not enough items to fill the viewport.
Is there a way to make sure that there's always a TableRow with no item at the bottom of the table?
Edit: Adding a context menu to the entire TableView and automatically add row at the bottom when that is used is not an option either. This is because I need to add a style class to the row below the input index to provide the user with feedback on where the row will be placed. Therefore there needs to be a TableRow object to add the style class to.
Edit: I realize my text was a little bit messy. Here's an attempt at clarifying the actual behaviour I want:
I don't want the viewport to always display an empty row at the bottom, which would be some kind of "sticky row" behaviour. I want the actual table to display an empty row after the last row. I.e: When I'm in the "middle" of the list, and can't see the last row, no empty row should be displayed. The only time the empty row is needed is when I want to add an item at the end of the table list. Therefore when I scroll down so I see the end of the list, that's when I need an empty row. The reason I need this exact behaviour is explained in the original text.
i have a Gridview with a single column which is a template field with an image and a label.
By default, the gridview expands vertically according to the items in the datasource.
But in my case most of the screen space is left unused and the page becomes extremely long.
So it'd be great if the one and only template field automatically becomes a new column (starts again from the top next to it's initial position after a fixed height) or SPANS HORIZONTALLY, not vertically...
i've done some searching and still can't find a solution for this..
any help would be great..!
i took 2 screenshots for a better explanation but the site won't allow me to post images yet :/
I think you are looking for the DataList control. Namely, the RepeatColumns property.
I'm trying to set the scroll vertical position of a spark dataGrid to show the items as I add them to the grid. I know you can set the scroll position like this:
dataGrid.scroller.viewport.verticalScrollPosition = itemPosition*rowHeight;
The problem is that the dataGrid have variableRowHeight, as each row word wraps their name labels, and I don't know how to get each row height. I though of getting the itemRenderer associated with every item as I add it to the grid, and keep the total row height value in a variable, but don't know how to achieve that.
Is there any way to set the scroll position of a dataGrid with variableRowHeight to show the last added item?
After you set your dataprovider, you could do something like
dg.validateNow();
dg.verticalScrollPosition=dg.grid.contentHeight+dg.grid.height;
Is there a way to hide all the DataGrid columns, and not make them included in layout, and still show the header row along with its header text?
I was able to make the DataGrid columns not visible, and not included in layout, but that makes the header text no longer appear.
If no data comes back from the data provider, I want all the columns to disappear and then the header row still be visible along with its text.
Any helps is appreciated. If I cannot figure it out, I guess I will just not show the entire grid at all, but I really want the header row with its text to still be visible.
FYI - In the place of the grid columns, I have a message alert appear, which is why I still want the header row with its text, but I need to not have the columns included in the layout, or visible so I can display the alert message.
Thanks
A DataGrid allows you to set the rowCount, which is the number of visible rows. Note that the header row is considered a row, so if you want to show just the header, set the rowCount to 1. Hope that helps.
I have a gridview control that can get loaded with multiple pages worth of data. When I switch pages, the columns widths will change to accommodate the largest value in the column for that page.
If possible, I would like to set the widths of each column to the widest necessary width for the entire dataset.
You can set the ItemStyle-Width property on each TemplateField, BoundField, etc. in your gridview to whatever you want. That should hold across paging. You will want to either not set the gridview width, or be sure you don't use a percentage if you do.
If you want to figure this out dynamically, you will have to examine your data first, before binding your grid, figure out the width that you want, then bind your gird and dynamically set the ItemStyle-Width in the RowDataBound event of the gridview.
Tring things, in the edit colum menu of your grid you should try the auto size mode, I configure my to cell and it work pretty well for my needs..
This is available when you are not autogenerating the columns.
Try it.