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
Redisplaying saved data grid
25/11/2008
14:16
Avatar
Chris N
Member
Members
Forum Posts: 3
Member Since:
21/11/2008
sp_UserOfflineSmall Offline

I have gone through the steps of saving a datagrid to the server once a user changes the columns they want displayed, but what I have found is that when I use

var gridInfo = JSON.stringify($("#list").getGridParam());

the onSelectRow: paramater is not returned, which is a function that uses the id of the row to display some information elsewhere on the page. So what I'm now trying to do is just see if I can add the onSelectRow through using setGridParam after the grid has been generated. But this doesnt seem to be working. Here is what I have right now. The $data_grid_params is either build from the default values I have predefined, or pulled from the server if the user has saved them previously.

jQuery("list").jqGrid($data_grid_params).navGrid('#pager',{edit:false,add:false,del:false,search:false});
   
    jQuery("list").setGridParam({onSelectRow: function(id){
        if(id && id!==lastSel){
            if ($('#job_data').is(":hidden")) {
                $('#job_data').slideDown("slow");
            }
            lastSel=id;
            loadJobListCalendar(id);
        }       
    }});

jQuery("#change_columns").click(function() {
        jQuery("#list").setColumns({
            left:50,
            top:50,
            height:495           
        });
    });
   
    jQuery("#save_grid").click(function() {
        jQuery('#list').setSelection('1');
        var gridInfo = JSON.stringify($("#list").getGridParam());
        saveFilter(gridInfo);
    });

Any guidance here would be greatly appreciated.

26/11/2008
01:36
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

What is the error, that you recieve? With setGridParam you can

set anything possible including onSelectRow. I have successifully

implement in the development version of jqGrid the stringify and for

now it works fine. I suppose that you make eval of the string, before

passing it to jqGrid.

If possible before passing this parameters to the grid - check them to

see what you have. Also check what you have as string after stringify.

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.

28/11/2008
02:24
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

Since I have successed with this conversion - the problem is that

JSON.stringify does not support type function when convert to string.

This caouses not correct exporting of the events (functions). To work this

open the file that contain JSON.stringify method and at the end add

the following:

...

        case 'boolean':
            return String(arg);

// Adding

        case 'function' :
             return arg.toString();

// end of add

        default:
            return 'null';
        }
.....

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.

30/11/2008
20:32
Avatar
Chris N
Member
Members
Forum Posts: 3
Member Since:
21/11/2008
sp_UserOfflineSmall Offline

Can you guys show me or tell me where you got your JSON javascript file?

01/12/2008
03:22
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Open the file that contain JSON.stringify function. Usuallly its name is

json.js. Just find stringify function and at end of this function add these

lines.

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.

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
66 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