Hi,
I set my ultragrid to groupby a certain column in initialize layout itself. Once after performing certain operation on a particular row like moving from one group to another group etc I am performing this action to refresh the grid.
DisplayLayout.Bands(0).SortedColumns.RefreshSort(True)
Upto now its fine. But After refreshing every group is closed. How can I set my focus on a particular group and make it show its rows on refresh.
Nagarjun.
I have a seen a selected property. I think it will solve the issue.
What is the function which returns the collection of rows associated with a group by column.
In what way do the ultragrid display rows when groupby a particular column. If i group by a comment_id 35 and if there are 5 rows, by default in which order do the grid display them in the group by band. Is there any way which I can set programatically based on some other column.
Hope my question is clear enough
When you refresh the grouping on the entire grid, all existing rows are destroyed and a whole new set of rows are created. So there's no way the grid can maintain the state (expanded or selected) of the rows.
If you are only moving a single row, then what you should do is call RefreshSortPosition on the row. This will move the row to it's correct sort position in the grid without affected any other rows.
If you have to call RefreshSort and re-sort the entire grid, then you would have to loop through the rows after the sort is complete and find the row you want and expand it's parent.
My problem here is I am unable to figure out onething.
I am performing my group operation based on a column by name comment_id. For example I have four rows that has comment_id 25 and so, after grouping is done I see four rows under comment_id 25.
According to my goal, I can make the end user add new rows within this group. So, When the user tries to add a new row, I am adding a new row into the dataset with comment_id = 25 and then calling
grid.update(). Until now it works fine. But the problem is if the user tries to insert a row betweeen the second and the third one, it is always inserting at the top of that group. I mean it is always showing an empty row only at the top of the grid irrespective of the index which i set it to.
I am unable to understand on what basis it displays rows once grouping is done. Does it look for some column to display.
Let me know
When I try to insert row between 1 and 2nd row It is inserting at the top of the group always,how to make the new row appear between. If you look at the second column, that is my sort order for each group, eventhough I set it 2 it is still showing above 1,do i need to call some function.
I cannot see the column headers in your screen shot, so It's hard to guess what's going on here.
The order of the rows in the data source has nothing to do with the order of the rows in the grid, though, once the grid is sorted or grouped. So it seems like you will need to find the newly-added row in the grid and use the Move method on the Rows collection to move it to the position you want.
Or else, you could sort the grid by another field in addition to the grouped field.