Hello
When I use grouping functionality of XamDataGrid (v 11.1.20111.2193), all GroupByRecords have following label:
x items
where x is the number of child records.
I wanted to change that "items" to my custom text (for instance: "elements," "datasets" and so on).
I was able to do this by InitializeRecord event:
var gbr = record as GroupByRecord; if (gbr != null) { var count = gbr.ChildRecords.Count; gbr.Description = string.Format("{0} ({1} {2})", gbr.Value, count, "elements"); }
It works as expected, the "items" are now "elements". However:
- if I filter records, the group counteris not refreshing (obviously, because I've not added event handler.
(by default, it's refreshed when filter is changed).
Soo, I did:
RecordFilterChanged+= ... (and recalculate)
And now, I have no idea how to recalculate based on filtering (Record class doesnt have "IsFilteredOut" property right?)
I was trying to play around with RecordsManager.GetFilteredInRecords() but this also didn't work fully as expected, and I thought It's too much. Also tried with Visibility of each record, but this is also dead end.
Even If I manage to handle filters, I'm not sure if those events are all I need to handle.
Can you give me some feedback how to simply change "items" to custom text in GroupByRecord (if possible - without need to recalculating all the grouping functionality).
HI,
I had to retemplate the GroupByRecordPresenter and added a converter to change the format.
Please review my sample.
Sincerely, Matt Developer Support Engineer
I am just following up on this post.
Please let me know if you need further assistance.
Sincerely. Matt Developer Support Engineer
Hi Matt
Thanks for the sample. This is in fact exactly what I needed.
Small issue is that, when I have custom "items" text, in makes no sense in nested grouping. Just a suggestion: Would be nice to have (in future versions) an option in grid that says "groupby items count calculaton type".
One value would be Default (as it is now)
Second option would be .. count all the leaf elements in all subnodes.
Then it makes more sense to change that "x items" to "x something".
But, again - this is just a suggestion. Thanks for sample once again!
What do you mean when you Count CalculationType?
Can you give me an example?
Sincerely, MattDeveloper Support Engineer
Sure.
When nested grouping is in place, there is "x items" label where "x" is the number of direct child nodes (and it doesn't matter how many child nodes there are deeper in the group tree)
When I renamed "x" to "cars" for example, then it makes no sense in nested grouping. For example: there is an item called "2 cars". Then I expand it and see two child nodes, both having "50 cars".Nonsense, isn't it ?
Thats why, it would be nice to have an option, should the "x" be default : just a number of direct child nodes, or : count all child nodes under it. (in our example that would be :
- (100 cars)
- (50 cars)
But again: this is just a suggestion to this particular example, that we change "items" to particular thing.
hi
was this feature implemented?
best regards
jan