Hi there,
The project I am working on has licensed teleric control suite. I am looking at making the RadGrid keep expanded rows expanded whilst using simple binding (i.e. not NeedDataSource event).
Is this possible?
Or do I need to stick to advanced data binding?
Thanks in advance,
Ron
The project I am working on has licensed teleric control suite. I am looking at making the RadGrid keep expanded rows expanded whilst using simple binding (i.e. not NeedDataSource event).
Is this possible?
Or do I need to stick to advanced data binding?
Thanks in advance,
Ron
6 Answers, 1 is accepted
0
Shinu
Top achievements
Rank 2
answered on 05 Sep 2008, 05:11 AM
Hi Ron,
Hope you are using a Hierarchical grid. Hierarchical structure is not supported with simple data-binding (calling DataBind()). You can either use AdvanceDataBinding techniques or declarative data sources to populate the Grid.
Thanks
Shinu
Hope you are using a Hierarchical grid. Hierarchical structure is not supported with simple data-binding (calling DataBind()). You can either use AdvanceDataBinding techniques or declarative data sources to populate the Grid.
Thanks
Shinu
0
Ron
Top achievements
Rank 1
answered on 09 Sep 2008, 02:49 AM
Hey Shinu,
Thanks for the tip. I have switched back to using advanced data binding.
The state (expanded or collapsed) is kept correctly when I use the built in 'Delete' command or I do any post back's.
But the trouble is that we are inserting and updating the data from an external user control - when I call radGrid.Rebind() method, the grid itself is reloaded with correct values but the state gets lost (i.e. everything collapses).
Is this not supported? I tried to somehow use OnUpdateCommand and OnInsertCommand to no avail and it feels it's not the right way to go about.
Any help would be much appreciated.
Thanks,
Ron
Thanks for the tip. I have switched back to using advanced data binding.
The state (expanded or collapsed) is kept correctly when I use the built in 'Delete' command or I do any post back's.
But the trouble is that we are inserting and updating the data from an external user control - when I call radGrid.Rebind() method, the grid itself is reloaded with correct values but the state gets lost (i.e. everything collapses).
Is this not supported? I tried to somehow use OnUpdateCommand and OnInsertCommand to no avail and it feels it's not the right way to go about.
Any help would be much appreciated.
Thanks,
Ron
0
Shinu
Top achievements
Rank 2
answered on 09 Sep 2008, 03:48 AM
Hi Ron,
Here is a code library submission which explains how to retain the expanded state of a Hierarchical grid on rebind.
Retain expanded/selected state in hierarchy on rebind
Hope this helps..
Shinu
Here is a code library submission which explains how to retain the expanded state of a Hierarchical grid on rebind.
Retain expanded/selected state in hierarchy on rebind
Hope this helps..
Shinu
0
Ron
Top achievements
Rank 1
answered on 09 Sep 2008, 09:40 PM
Hey Shinu,
Thanks again! That was pretty close actually. Am I correct in saying that there is no built in solution for perserving the state of hierarchy on rebind?
The only issue I have now is that I need to support client side expand and collapse as opposed to server side. I have seen that there is a hidden server control called ClientState that seems to keep track of what's been expanded on the client side. Perhaps I'll try pulling the state information from this one to persist it..
What do you think?
Cheers,
Ron
Thanks again! That was pretty close actually. Am I correct in saying that there is no built in solution for perserving the state of hierarchy on rebind?
The only issue I have now is that I need to support client side expand and collapse as opposed to server side. I have seen that there is a hidden server control called ClientState that seems to keep track of what's been expanded on the client side. Perhaps I'll try pulling the state information from this one to persist it..
What do you think?
Cheers,
Ron
0
Nicolaï
Top achievements
Rank 2
answered on 04 Sep 2009, 04:50 PM
Is there any way to do this (retain expand collapse state) client side?
It'd probably be possible to store keyvalues of expanded rows in an array and launch a js function to expand those rows..?
Just thinking out loud, hoping someone has an easier way?
It'd probably be possible to store keyvalues of expanded rows in an array and launch a js function to expand those rows..?
Just thinking out loud, hoping someone has an easier way?
0
Nicolaï
Top achievements
Rank 2
answered on 04 Sep 2009, 09:38 PM
Well, I put my thought "on paper":
Seems to work, not tested in all scenarios.. I'm using clientside expand/collapse of the ierarchy grid.
(And drag&drop is a big part of the grid..)
Seems to work, not tested in all scenarios.. I'm using clientside expand/collapse of the ierarchy grid.
(And drag&drop is a big part of the grid..)
| Array.prototype.remove=function(value){ |
| for(var i=0;i<this.length;i++){ |
| if (this[i]===value){ |
| this.splice(i,1) |
| return this |
| } |
| } |
| } |
| var expandedIndexes=new Array(); |
| var cancel=false; |
| function OnHierarchyCollapsed(sender, eventArgs) |
| {expandedIndexes.remove(eventArgs.get_itemIndexHierarchical());return false;} |
| function OnHierarchyExpanded(sender, eventArgs) |
| {if (!cancel) |
| {expandedIndexes[expandedIndexes.length]=eventArgs.get_itemIndexHierarchical();return false;} |
| } |
| function OnGridCreated(sender, eventArgs) |
| {if (expandedIndexes.length>0) |
| {cancel=true; |
| for (var i=0;i<expandedIndexes.length;i++) |
| {sender.get_masterTableView().expandItem(expandedIndexes[i]);} |
| cancel=false; |
| return false;} |
| } |
| <ClientSettings AllowRowsDragDrop="True"> |
| <Selecting AllowRowSelect="True" EnableDragToSelectRows="true" /> |
| <ClientEvents OnGridCreated="OnGridCreated" OnHierarchyCollapsed="OnHierarchyCollapsed" OnHierarchyExpanded="OnHierarchyExpanded" |
| OnRowDropping="onRowDropping" OnRowCreated="RowCreated" OnRowDragStarted="RowDragStarted" /> |
| </ClientSettings> |