Forum


06:02

16/09/2008

I have seen the cookie method on how to save and retrieve grid settings. I would like to save the settings on the server, so that users who work on different PCs can take their settings with them.
I have a button which is used to save other stuff by passing variables to the php script:
******************
jQuery(â€#a_todayâ€).setGridParam({url:â€/ajax/update_stuff.php?somestuff=â€+somestuff,page:1}).trigger(â€reloadGridâ€);
******************
How can I pass the grid params to the server?
******************
var gridparams = $(’#a_today’).getGridParam();
jQuery(â€#a_todayâ€).setGridParam({url:â€/ajax/update_stuff.php?somestuff=â€+somestuff+’&gridparams=’+gridparams,page:1}).trigger(â€reloadGridâ€);
******************
The problem is that gridparam is an object - and it is huge. If I dump the object I can see that it is thousands of characters.
Can I compress / encode it and then uncompress / de-encode when to be used to retrieve grid settings?
Or should I just save only the properties I wish to be saved such as column names, widths etc. getgridparam(columns, widths….
11:19

Moderators
30/10/2007

Hello,
At end of next week I will publish roadmap.
One of the priority task is to configure the grid from xml
and/or json data - that is - there will be import and export methods
Regards
Tony
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
07:41

16/09/2008

tony is there any progress on this?
In the meantime how can I save and load the grid parameters for just the columns?
I am using the setcolumns js which works great but the info is lost when the page is reloaded. I am also changing the column widths but this info is also lost on page reload.
what getgridparam do I need to use to get that info?
currently the documentation only shows:
“urlâ€
“sortnameâ€
“sortorderâ€
“selrowâ€
“pageâ€
“rowNumâ€
“datatypeâ€
“recordsâ€
“selarrowâ€
06:29

Moderators
30/10/2007

Hello,
Yes I'm just succesed with some new features. See roadmap.
Now I discover the problem with the pager. To resolve this
do not use
pager : jQuery("#mypager")
but just
pager : "mypager"
It will work.
For now you can use some like stringify function (just google it)
to convert the array to string.
Regards
Tony
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
08:54

16/09/2008

Thanks for the pointers tony. I am now using JSON.stringify to convert the js object into text.
*********************
loadComplete: function() {
jQuery('#a_all').setSelection('1');
gridParam = JSON.stringify($("#a_all").getGridParam());
alert(gridParam);
}
*********************
What that does is alert a huge text file of all the grid settings. Is it possible to just get the settings for the columns?
The documentation only shows selective options for
“urlâ€
“sortnameâ€
“sortorderâ€
“selrowâ€
“pageâ€
“rowNumâ€
“datatypeâ€
“recordsâ€
“selarrowâ€
09:09

16/09/2008

Tony, I found the getColProp function in the docs. This sort of gives me what I want but you have to name each column - you can not get info on all the columns.
This does not work:
*********************
gridParams = JSON.stringify($(â€#a_allâ€).getColProp());
*********************
So I have to do this
*********************
gridParams1 = JSON.stringify($(â€#a_allâ€).getColProp(â€idâ€));
gridParams2 = JSON.stringify($(â€#a_allâ€).getColProp(â€nameâ€));
gridParams3 = JSON.stringify($(â€#a_allâ€).getColProp(â€dateâ€));
*********************
Note too that I think there is a problem with the column widths not being updated.
I have a column name and if I look at the properties it shows:
*********************
{â€nameâ€:â€nameâ€,â€indexâ€:â€nameâ€,â€widthâ€:160,â€editableâ€:true,â€edittypeâ€:â€textâ€,â€editoptionsâ€:{â€sizeâ€:â€75″,â€maxlengthâ€:â€250″},â€resizableâ€:true}
*********************
That’s fine. Now if I use the hide/show column feature to remove this from the grid it shows:
*********************
{â€nameâ€:â€nameâ€,â€indexâ€:â€nameâ€,â€widthâ€:160,â€editableâ€:true,â€edittypeâ€:â€textâ€,â€editoptionsâ€:{â€sizeâ€:â€75″,â€maxlengthâ€:â€250″},â€resizableâ€:true,â€hiddenâ€:true}
*********************
That is fine too as it is correctly stating that the column is now hidden.
But if I show the column and adjust the width manually (by dragging the separator bar) then the change is not being shown. If I drag / shrink / expand the name column on screen the width is always showing as
*********************
“widthâ€:160
*********************
Should not this change as I change the column width on screen?
02:37

Moderators
30/10/2007

Hello,
Some properties does not change (like width) if you change it dynamically. But I think this should be.
Anyway I will look how can correct this.
Thank you
Regards
Tony
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
Most Users Ever Online: 715
Currently Online:
176 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66