Hi ,
I'm using wingrid 8.2 ver. i have created three groups using SortedColumns.Add method.
Right now it is showing 3 group by rows and its child rows.
Now i want to hide or remove first 2 group by rows not its child rows. Is there any way to do it.
Please let me know.
Thanks
Amit
Hi Amit,
No, you can't hide a parent GroupByRow without hiding it's children.
If you want to group the grid based on the combined values of 3 fields, what you can do is write your own custom SortComparer to sort the data and your own custom GroupByEvaluator to handle the grouping. Then you would simply group on one column and group by all three fields at once.
Hi Mike.
Can you provide me the sample or link so i cam impliment
I don't know of any samples of exactly what you are describing here. There's really not much to it, though.
You need to create a class that implements IComparer and apply it as a SortComparer to a column in the grid. The Compare method on this interface will be called and pass in two grid cells. You would examine the grid cells and they other values in the row. This will allow you to sort the grid by all three columns at the same time.
Then you create another class which implement IGroupByEvaluator. Again, you attach this to the same column as the GroupByEvaluator and you can tell it to group the column only when all three fields match.
I've been searching the forum regarding this same issue. We have a client that wants to only group and have a "node" for like items and if there is only 1 item then show no "node" and only display the row. If there is only one item there should be no group. I understand that using the OutlookGrouping we can mix a standard row with a groupbyrow.
Is there any workaround for this? The Height property of the GroupByRow is only setting the min value, so we can't set it 0 to hide it. Can we use elements?
Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4
Data
122344
Display
1
+2
3
+4
Thanks for any input, direction to help solve this requirement.
Follow up:
Using the Ultra(Win)DataSource I was able to create the desired display. I've attached a screenshot of what I wanted to accomplish.
The UltraDataSource examples provided helped me get to this implementation.
Thanks for your suggessions Mike!!!
The client loves the features of the grid so I want to stick with it.
The good news is, the data that I want to group is all in the same table. There is a sort value, the sort value orders the data to match the physical paper work, so row 1 matches the 1st sheet and so on. There are instances where there are duplicate sort values (which means duplicate sheets, so we have a newer one along with older ones) and we need to group those together. Ideally, If I have 3 duplicates, to show the most recent row and then open the branch to show the older ones.
I will look at the samples and do some homework on the UltraDataSource.
Well, if you want to create a sort've manual data source, you could use UltraDataSource. You could group your data in code yourself, then copy it into an UltraDataSource. The problem is that the data structure still has to be homogenous. So all of the rows at the same level of the grid have to have the same columns. You could, of course, leave some of those columns blank for your "GroupBy" rows.
If you don't have a huge amount of data and you don't mind copying the data into another structure, then you might consider using the UltraWinTree instead of the grid. The tree can support non-homogenous data. You would still have to copy the data into some ILists or IBindingLists that you implement yourself, but you could then have a single list of items with different types of parent rows.
The other down side of using the tree is that it doesn't have some of the features of the grid like filtering or summaries.
Thanks for the your reply Mike. I was not too optomistic given the previous replies to this exact same question.
The only other way I know how can create this visual display would be a relationship? I don't think it's possible to relate back to the same data and exclude the top most record.
Can you add a row to an existing row to create a branch of rows?
I know this is out of your scope at this point; but, if anyone who has run across this challenge what they ended up doing (go a different direction, use a different control, etc).
Again, thanks for your help.
No, there's no reasonable workaround for this. You cannot mix data rows and GroupByRows in the same collection.
If you are looking for an unreasonably workaround, you could try using a CreationFilter to create normal data row elements inside of or in place of the GroupByRow. But this would be an extraordinarily complicated and difficutl task and I would not recommend attempting it.