Forum



12:16

30/08/2010

Hi, I Tryin' to make some kind of LiveGrid, loading data from JSON source.
It seems there is no built in Solution for refreshing the Grid on an given Interval?
So i do it like that:
var refreshgrid = setInterval(function() { jQuery("#%(id)s").jqGrid().trigger("reloadGrid"); }, 5000);
But there are a few Problems going like that:
1. After loadComplete the last selected row isn´t selected anymore - How can I restore the last selected row after every reload?
2. It seems that the Grid-data is flushed, before the same data is read in again(Grid flares on reload) - How can achieve, that only the changed fields(if any) will be replaced(at an given Interval)?
Thanks in advance.
JAY
15:16

30/08/2010

@1: If I set the refreshstate:"current" :
.jqGrid('navGrid','#%(id)s_pager',{refreshstate:"current"})
and then press the refresh-button in the Navigator, it works as expected(last selected row stays selected).
So I need to know how to make an "refresh" with refreshstate:"current" on an Interval...
Can anyone help?
15:48

10/08/2009

Hello!
You should use
to do this (see for example my old answer on the stackoverflow.com about this).
Best regards
Oleg
16:02

30/08/2010

OlegK said:
Hello!
You should use
$("#list").trigger("reloadGrid", [{current:true}]);to do this (see for example my old answer on the stackoverflow.com about this).
Best regards
Oleg
Thanks, I came up with this one too, found @jqGrid.min.js.
Can anybody help with 2. Replacing only fields, which changed on Server? Or put me in the right direction where to start?
Thanks.
Jay
16:26

30/08/2010

OlegK said:
Hello!
You should use
$("#list").trigger("reloadGrid", [{current:true}]);to do this (see for example my old answer on the stackoverflow.com about this).
Best regards
Oleg
Next one commin`in:
Everything works just fine with:
$("#list").trigger("reloadGrid", [{current:true}]);
until I do:
scroll: true,
After every reload the Grid jumps back to the Records 1-20 and if i have scrolled down and selected for Example record 15, It won´t work because it jumps back to Records 1-20 and no record is selected.
How can I achieve that the Grid stays in the last selected range of Records f.E. 20-30 and keeps the selected Record?
Thanks.
16:33

10/08/2009

Hi Jay,
I am not sure that I understand you correct. Do you use reloadAfterSubmit:false? I change some default values with
// some other settings
closeAfterAdd: true,
closeAfterEdit: true,
recreateForm: true,
reloadAfterSubmit: false
});
Best regards
Oleg
16:56

30/08/2010

OlegK said:
Hi Jay,
I am not sure that I understand you correct. Do you use reloadAfterSubmit:false? I change some default values with
jQuery.extend(jQuery.jgrid.edit, {
// some other settings
closeAfterAdd: true,
closeAfterEdit: true,
recreateForm: true,
reloadAfterSubmit: false
});Best regards
Oleg
I don´t use grid edit. I´ve got an Server-side Process running which is feeding the DB and on the client-side JQgrid frequently reads the DB per JSON.
And now erverything is working fine except if I set the Grid to:
scroll: true,
then after every reload, the Grid jumps to Records 1 -20(wont stay at last scrolled, Example 20-30), the grid wont select "current" if selected is above 20 and the Grid is shortly cleared bevore the Records are inserted again(@2.)
JAY
17:14

10/08/2009

I wrote before, that I was not sure what I understood you correct, but till now I don't really understand what you want to achieve.
With scroll:true I have no experience because I don't use it in my programs. Probably other persons can help you.
If you get the data from the server you use probably the paging of data, so only one page of data should be reloaded. Because the data can be also changed from another users of the database any optimization of the data loading can be done only on the server side. For example you can implement different caching of data (see this my old answer for example for additional information). In the case the data (the page) will be not transfered one more time and only revalidated.
Best regards
Oleg
20:24

30/08/2010

OlegK said:
I wrote before, that I was not sure what I understood you correct, but till now I don't really understand what you want to achieve.
With scroll:true I have no experience because I don't use it in my programs. Probably other persons can help you.
If you get the data from the server you use probably the paging of data, so only one page of data should be reloaded. Because the data can be also changed from another users of the database any optimization of the data loading can be done only on the server side. For example you can implement different caching of data (see this my old answer for example for additional information). In the case the data (the page) will be not transfered one more time and only revalidated.
Best regards
Oleg
Hi Oleg,
In the case the data (the page) will be not transfered one more time and only revalidated.
Thats exactly what I would like to do, setting
But I think I can´t implement that without your help.
For now the Solution:
$("#list").trigger("reloadGrid", [{current:true}]);
works, but as I said only if:
scroll: true,
is not set! Then the reload of the Grid is visible to the user(it is shortly empty, before the data is loaded again),
and there are issues with the scrolling, I´ve explained above.
Can anybody help me up with this?
Thanks for the effort till now Oleg.
JAY
Most Users Ever Online: 715
Currently Online:
73 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