This is a migrated thread and some comments may be shown as answers.

[Solved] GridSettingsPersister and Autoload

2 Answers 168 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Gunnar Skogen
Top achievements
Rank 1
Gunnar Skogen asked on 01 Mar 2010, 09:59 AM
Hi,

I am using the GridSettingsPersister with AutoLoad of the contents.
I want grid settings to work this way for the user.

1. 1rst time: The user's default settings are loaded.
2. If the user has changed his settings (from his defaults), leaves the page and returns, his last settings should be in effect
3. The user can always save or load his settings for the grid.

Having tried all(?) the server site grid events ( "ColumnCreated" looks like the one to use - rewrote the GridSettingsPersister to get values pr. column HeaderText for this), I cannot get the column order to take effect - column width is set ok but the order setting only take effect when I explicitly Ajax load the saved settings and then the order only takes effect after I make another  Ajax call that changes the contents of the grid. For 1. and 2. above , Ajax is not used (intial load of the page)  but the order never takes effect.
The Debugger shows the right order values being set - the correct order is just not shown on the screen.

Is this there a way around this or is this intrinsinct to the design when using autoload?

(If you read the original GridSettingPerister author's comments, he also states that he could not get it to work with autoloaded contents, but suggested trying ColumnCreated)
EnableViewState fale or true has no effect on this.

Correction:
Adding his to _PreRender makes the Ajax Loading of usersettings happen at once, the rest is the same:

SupportItemGrid1.DataSource =

null;

 

SupportItemGrid1.Rebind();



Best Regards

Gunnar Skogen


2 Answers, 1 is accepted

Sort by
0
Veli
Telerik team
answered on 02 Mar 2010, 02:30 PM
Hello Gunnar,

Try the attached sample project that has the GridSettingsPersister class rewritten to persist a larger set of grid settings. Let me know how it works.

Best wishes,
Veli
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
Gunnar Skogen
Top achievements
Rank 1
answered on 03 Mar 2010, 02:39 PM
Hi Veli,

That works much better thanks!
- See there is special stuff for autogenerated columns now so it figures this needed special treatment
The only circumstance it does not work in is when I have an Ajax call, targeted to the grid, and do a LoadSettings call:
The autoload columns are not seen by the code in this case. In the previous version this worked as previously stated, one Ajax call later, that is Button-Load -- ajax --> Grid (usersettings:no show ) and then  ButtonFilterGrid -- ajax --> Grid  (usersettings:show)

For me now this will do as I will rewrite to keep the latest grid settings pr user in the db and have no Save or Load Settings action available to the User

Best Regards

Gunnar
Tags
Grid
Asked by
Gunnar Skogen
Top achievements
Rank 1
Answers by
Veli
Telerik team
Gunnar Skogen
Top achievements
Rank 1
Share this question
or