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
Mixing server data and local data
01/02/2010
12:23
Avatar
frodeo
Member
Members
Forum Posts: 15
Member Since:
13/11/2009
sp_UserOfflineSmall Offline

I have a jqgrid with datatype json that loads data from the server. We now want to add comet streaming to the grid and update the data from javascript. If we are using datatype local then we can update the grid from the comet streaming scripts by using the setRowData method. It looks like this method only works for datatype local. How can this be done when we use datatype json? (the json data from the server decides which rows to show, and we have 10.000+ rows - so switching entirely to datatype local is not an option).

I have tried something like this when updating the grid, but it does not work for me:

            jQuery("#myGrid").jqGrid('setGridParam',{datatype:'local'});
            jQuery("#myGrid").setRowData(itemName, rowData);
            jQuery("#myGrid").jqGrid('setGridParam',{datatype:'json'});

Frode Oldervoll

01/02/2010
13:05
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

Try to use datatype as function. See examples.

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

11/03/2010
15:43
Avatar
dac60x
Member
Members
Forum Posts: 10
Member Since:
26/04/2009
sp_UserOfflineSmall Offline

Hi Tony,

Thank you for your help. Could you tell me the url where can I have the examples to use datatype as function?. I couldn't find them. Thanks again.

15/03/2010
20:46
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

Open the demo. select New in version 3.3 and the select Datatype as function

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.

09/04/2010
18:06
Avatar
frodeo
Member
Members
Forum Posts: 15
Member Since:
13/11/2009
sp_UserOfflineSmall Offline

I actually got this to work with mixing json data and local data. The important thing that was missing from my last attempt it to use the id of the row when calling setRowData, not the item itself. Something like this works for me:

var ids = $('#mygrid').getDataIDs();
for (var i = 0; i < ids.length; i++) {
    var item = $('#mygrid').getCell(ids[i], 0);
    if (item === cometItem) {
        $('#mygrid').jqGrid('setGridParam',{datatype:'local'});
        $('#mygrid').setRowData(ids[i], rowData);
        $('#mygrid').jqGrid('setGridParam',{datatype:'json'});
        break;
    }
}

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

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