This question is locked. New answers and comments are not allowed.
Hi all,
I must add a select all checkbox and an unselect all button to a RadGridView groups. The grouping is done by the user, the default view is a normal grid without groups, but the grouping option is enabled so the user can group the rows. The SelectionMode is set to Extended.
When the user has done so I must add a checkbox and a button to the header. First I suppose I'll have to edit the GroupHeaderTemplate or the GroupRowStyle (I still don't know which one) to add the checkbox and the button, that's not a problem. What I don't know how to do is selecting/unselecting only the rows that are part of that particular group.
Besides, when the user manually selects or unselects the checkbox IsChecked property must be refreshed.
How would I achieve that? I'm using MVVM, my ViewModel IsSelected property is already binded to the GridViewRow IsSelected property in TwoWay mode, that part works.
Thanks in advance,
-Tony
I must add a select all checkbox and an unselect all button to a RadGridView groups. The grouping is done by the user, the default view is a normal grid without groups, but the grouping option is enabled so the user can group the rows. The SelectionMode is set to Extended.
When the user has done so I must add a checkbox and a button to the header. First I suppose I'll have to edit the GroupHeaderTemplate or the GroupRowStyle (I still don't know which one) to add the checkbox and the button, that's not a problem. What I don't know how to do is selecting/unselecting only the rows that are part of that particular group.
Besides, when the user manually selects or unselects the checkbox IsChecked property must be refreshed.
How would I achieve that? I'm using MVVM, my ViewModel IsSelected property is already binded to the GridViewRow IsSelected property in TwoWay mode, that part works.
Thanks in advance,
-Tony
5 Answers, 1 is accepted
0
Joan
Top achievements
Rank 1
answered on 08 Jun 2011, 04:25 PM
I've half-solved my problem.
Instead of having a checkbox it's just a button to select all. This means I don't need to keep track of the "all items selected" status. I've had to modify the GridViewGroupRowTemplate and use a Behavior.
This method works so far but it's just a temporary workaround, I'll need a checkbox in the future so I still need to know how I can know whether all items in a group are selected and be refreshed of this value.
Regards,
-Tony
Instead of having a checkbox it's just a button to select all. This means I don't need to keep track of the "all items selected" status. I've had to modify the GridViewGroupRowTemplate and use a Behavior.
This method works so far but it's just a temporary workaround, I'll need a checkbox in the future so I still need to know how I can know whether all items in a group are selected and be refreshed of this value.
Regards,
-Tony
0
Accepted
Hello Tony,
Greetings,
Milan
the Telerik team
Please take a look at this sample implementation.
Hope it helps.
Greetings,
Milan
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items
0
Joan
Top achievements
Rank 1
answered on 20 Jun 2011, 08:42 AM
Hello Milan,
First, sorry about the late reply, I've been very busy with something else.
Your sample solves some issues, but there are still some problems. I wanted to check what happens with more than one item per group (but still more than one group), so I modified one method this way:
Note the "Name" line. This way I have 5 items per group when grouping by Name. Every time I use the checkbox on the Group header everything works well, the problem comes when I individually select or unselect an item, the group's checkbox isn't refreshed. The result is the attached image.
Basically, I need a way to receive a message every time an item selection changes from every group. Easier said than done. Maybe a mix of events and attached properties? I don't mind inheriting RadGridView if I must, in fact, I've already done so.
Thanks,
Tony
EDIT: I attached a different image than intended and I can't remove an attachment. The correct file is "GroupRefreshProblem.png".
First, sorry about the late reply, I've been very busy with something else.
Your sample solves some issues, but there are still some problems. I wanted to check what happens with more than one item per group (but still more than one group), so I modified one method this way:
public
static
IList<Customer2> GetAll()
{
return
(from index
in
Enumerable.Range(1, 20)
select
new
Customer2
{
ID = index,
Age = 20,
Name =
"Customer "
+ (index % 4 + 1),
JobCode = 1000 + index,
City =
"Halifax"
}).ToList();
}
Note the "Name" line. This way I have 5 items per group when grouping by Name. Every time I use the checkbox on the Group header everything works well, the problem comes when I individually select or unselect an item, the group's checkbox isn't refreshed. The result is the attached image.
Basically, I need a way to receive a message every time an item selection changes from every group. Easier said than done. Maybe a mix of events and attached properties? I don't mind inheriting RadGridView if I must, in fact, I've already done so.
Thanks,
Tony
EDIT: I attached a different image than intended and I can't remove an attachment. The correct file is "GroupRefreshProblem.png".
0
Accepted
Hi Tony,
That ca be fixed by simply calling InitializeCheckState in the
Best wishes,
Milan
the Telerik team
That ca be fixed by simply calling InitializeCheckState in the
GridView_SelectionChanged event handler in GroupSelectionBehavior
Best wishes,
Milan
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items
0
Oliver
Top achievements
Rank 1
answered on 23 Mar 2012, 03:51 AM
Hi,
I found another refresh problem :(
check all group checkboxes, expand a group to make the last group dissapear over the bottom display area, unexpand all groups and now some group checkboxes becomed unchecked!!!
Thank's
I found another refresh problem :(
check all group checkboxes, expand a group to make the last group dissapear over the bottom display area, unexpand all groups and now some group checkboxes becomed unchecked!!!
Thank's