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_Related Related Topics sp_TopicIcon
LiveGrid - Loop updateGridRows
12/11/2010
19:12
Avatar
jwinns
Member
Members
Forum Posts: 16
Member Since:
30/08/2010
sp_UserOfflineSmall Offline

Hi,
is there a way JqGrid (jsonreader) first get all records (of course) and then in a loop only get, on there server changed records and update them in the Grid? And how, with updateGridRows or addJSONData, ?
By now I do it like that, but this only reloads the Grid in a loop and every time loadComlpete it gets the full Dataset(and there is an Problem when Scroll is=true,then the Grid gets empty while new data is requested):

jQuery(document).ready(function(){jQuery("#list").jqGrid({
url:'test.html',
datatype: "json",
colNames: any,
colModel: any,
rowNum:10,
rowList:[20,50,100],
pager: '#pager',
scroll:true,
loadComplete: function () {

    setTimeout(function(){
     jQuery("#list").jqGrid().trigger("reloadGrid", [{current:true}]);
     return false;

}, 1000);

},   
loadError: function () {

    setTimeout(function(){
     jQuery("#list").jqGrid().trigger("reloadGrid", [{current:true}]);
     return false;

}, 15000);

},   
caption: "any",
viewrecords: true,
gridview: true,
height: any,
width: any,
loadui:"disabled",});
jQuery("#list").jqGrid('navGrid','#list_pager',{search:true,add:false,edit:false,del:false});
});

THX

JAY

16/11/2010
16:59
Avatar
jwinns
Member
Members
Forum Posts: 16
Member Since:
30/08/2010
sp_UserOfflineSmall Offline

Server-Side is ready.

the json url call first returns the full set of rows:

{"userdata": 1289918647843, "total": 2, "rows": [{"cell": ["1", "None", "8", "yes", "ddddddd", "ddddddddddddddddd", "dddddddddddddddd", "ddddddddddddddddddddd", "True", "True", "ddddddddddddddd", "9999999999999"], "id": 1}, {"cell": ["2", "", "0", "test", "jjjjjjjjjjjjj", "jjjjjjjjjjjjjjj", "jjjjjjjjjjjjjjjjj", "jjjjjjjjjjjjjjjjjjjjjjjjj", "True", "True", "jjjjjjjjjj", "None"], "id": 2}, {"cell": ["3", "", "3", "test", "", "", "", "", "False", "False", "", "None"], "id": 3}, {"cell": ["4", "", "None", "ddd", "", "", "", "", "False", "False", "", "None"], "id": 4}, {"cell": ["5", "", "None", "fffffffffffffffffffffffffffffffffffffffffffffffffffffffff", "", "", "", "", "False", "False", "", "None"], "id": 5}, {"cell": ["6", "", "None", "alt2", "", "", "", "", "False", "False", "", "None"], "id": 6}, {"cell": ["7", "", "None", "hure", "", "", "", "", "False", "False", "", "None"], "id": 7}, {"cell": ["8", "", "None", "8", "", "", "", "", "False", "False", "", "None"], "id": 8}, {"cell": ["9", "", "None", "8888", "", "", "", "", "False", "False", "", "None"], "id": 9}, {"cell": ["10", "", "None", "10", "", "", "", "", "False", "False", "", "None"], "id": 10}], "page": 1, "records": 13}

and after that it returns timestamp filtered results( To be updated in the Grid):

{"userdata": 1289919036281, "total": 1, "rows": [{"cell": ["1", "None", "newvalue", "newvalue", "ddddddd", "ddddddddddddddddd", "dddddddddddddddd", "ddddddddddddddddddddd", "True", "True", "ddddddddddddddd", "9999999999999"], "id": 1}, {"cell": ["13", "", "None", "newvalue", "", "", "", "", "False", "False", "", "9999999999999"], "id": 9}], "page": 1, "records": 2}

I need to know, how to update the Rows with every json url call, while keeping the first result. Is there any Solution for that?

Thanks.

JAY

16/11/2010
17:18
Avatar
jwinns
Member
Members
Forum Posts: 16
Member Since:
30/08/2010
sp_UserOfflineSmall Offline

I have already tried like that:

    complete: function(jsondata, stat) {
        if (stat == "success") {
            var thegrid = jQuery("#list")[0];
            thegrid.updateGridRows(JSON.parse(jsondata.responseText).d, "id", true);
        }
    },

but it does not work, only the last returned rows are in the Grid.

please helpCry

JAY

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

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