Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_TopicIcon
Saving Grid Settings on the Server
11/10/2008
06:02
Avatar
Larry D
Larry D
Member
Members
Forum Posts: 30
Member Since:
16/09/2008
sp_UserOfflineSmall Offline

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….

12/10/2008
11:19
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

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.

22/10/2008
07:41
Avatar
Larry D
Larry D
Member
Members
Forum Posts: 30
Member Since:
16/09/2008
sp_UserOfflineSmall Offline

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”

25/10/2008
06:29
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

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.

26/10/2008
08:54
Avatar
Larry D
Larry D
Member
Members
Forum Posts: 30
Member Since:
16/09/2008
sp_UserOfflineSmall Offline

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”

26/10/2008
09:09
Avatar
Larry D
Larry D
Member
Members
Forum Posts: 30
Member Since:
16/09/2008
sp_UserOfflineSmall Offline

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?

29/10/2008
02:37
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

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.

24/11/2008
08:12
Avatar
Chris N
Member
Members
Forum Posts: 3
Member Since:
21/11/2008
sp_UserOfflineSmall Offline

I'm trying to implement the code above, but for some reason I am receiving a JSON is undefined error. I tried searching Google to resolve the issue but found no relevant information to help me.

24/11/2008
15:07
Avatar
Larry D
Larry D
Member
Members
Forum Posts: 30
Member Since:
16/09/2008
sp_UserOfflineSmall Offline

Chris,

one gotcha is when cut and pasting code from this type of board. The quotes do not paste correctly so make sure after you paste the code you overwrite single and double quotes with the correct chars from your keyboard.

Forum Timezone: Europe/Sofia

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.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information