Related to this: ?
http://www.telerik.com/community/forums/aspnet-ajax/grid/problem-with-single-group-expand-collapse.aspx
Thanks!
6 Answers, 1 is accepted
Can you please supply some additional information on your setup. What group load mode are you using? To you have additional code/scripts related to this functionality?
Any additional information will help us better address the question at hand.
All the best,
Yavor
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.
So, it looks like I need to maintain the state of the grid expand/collapse, as well as sorting, column order, and other factors, so that when we return from postback the grid will always be in the proper state. I've started to code this into my project using the GridSettings class from the following page:
http://www.telerik.com/community/code-library/aspnet-ajax/grid/storing-multiple-grid-settings-in-database-via-profile.aspx
Is that accurate, or is there some other mechanism for saving the grid grouping/soriting state between postbacks?
Thanks!
Basically, the state of the items will be preserved when expanding/collapsing grouped items. This is demonstrated in the following example:
http://demos.telerik.com/aspnet-ajax/grid/examples/groupby/outlookstyle/defaultcs.aspx
Please, let me know if your setup is similar to the one shown above, or if there are other settings/code to take into consideration.
Kind regards,
Yavor
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.
As an example ... I'm leaving out some details here but this may help someone else doing this. I just want to share my confusion about what's happening. This isn't a complete set of details intended to help the diagnosis:
- Cycle 1: We get the normal life cycle of PreInit through InitComplete. Then LoadState starts for the postback. While in LoadState the grid gets ItemEvent GridInitializePagerItem and high-level ItemCreated events. That was unexpected. After LoadState there is a ProcessPostData event, and then we go to Cycle 2.
- Cycle 2: This begins with PreLoad and Load for the main page but not for the grid as it does on an initial (non-postback) page load. The grid gets no Load or LoadComplete, but it does go through DataBind here. When DataBound is fired on the grid, PageLoad completes for the web page and then PageLoad begins for the grid. I get a trace log that says "Begin ProcessPostData Second Try" - I need to see where that's coming from.
- Cycle 3: Now the ChangedEvents and PostBack events start. Here the grid gets a GroupsChanging event and then the other Item events repeat - normal ItemEvent and ItemDataBound events fire, now interspersed with ItemCreated events for GroupHeaders.
I see how the very simple Outlook sample preserves grouping between postbacks but it looks like my grid is going through a refresh on postback and therefore loses the state of which groups are collapsed - so only the latest single collapse is seen after each postback.
My process of trying to figure out what's going on in there is to turn on tracing, create event handlers for every possible event (that's a lot of guess-work), and set Begin/End Trace.Write() statements around base handlers. It's a sloppy way to figure out where to put code but this is helping me to find events that seem to popup out of the normal page/control life cycle. In addition to trying to figure out this one issue, I'd like to find a better way to diagnose this whole class of problem where we need to do something with a grid, don't know where values are being set, and we need to inject code into the right place to accomplish the goal.
If required I'll see if I can package some code and the events that are firing (maybe in a Support ticket), but as always, it's not practical to provide my entire solution for Telerik to diagnose an issue.
Thanks again!
Can you please supply some additional details on your setup - how is the grid populated with data? Is the grid rebound at any time? Does the grid, or any containing control call .databind() directly?
Additionally, you can isolate a small subset of the setup/code, and send it to us in a formal support ticket. We will review it and advise you further on the cause of the problem of why the grid does not persist its state.
Sincerely yours,
Yavor
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.
Thanks for the exchanges!