jQWidgets Forums
jQuery UI Widgets › Forums › Grid › Updating an existing grid with new data
This topic contains 6 replies, has 2 voices, and was last updated by Hristo 5 years, 9 months ago.
-
Author
-
Hi,
I’m trying to do, what I believe is a common, straight-forward task with the grid.
I initialize a grid with data from the server. The grid DATA can be *COMPLETELY* reloaded with new data either via ajax call or a webwocket push to the page.My grid is defined:
datatype: "json", localdata: myTableData, id: '_id', async: true, sortdirection: 'desc', dataFields: dataFields: [ { name: '_id', type: 'string' }, { name: 'messageSource', type: 'string' }, etc...
The data loads fine. When I get new data from server I am reloading it via the gridSource:
myGridSource.localdata = mynewdata;
$(‘#mygrid’).jqxGrid(‘updatebounddata’, ‘cells’);This also works fine. However, I have noticed that when I repeatedly do this I get a terrible memory leak in Chrome. On each load (either via button click or push from server) I witness the memory jump at least 10-20 mb. I am only loading 10-20 records back into the grid! So I want to be sure this is the proper way of reloading new data into a existing grid. Is it correct to refresh the localdata?
Note: to be sure it wasn’t a side-effect of other things occurring in the page I commented out the load and page is stable. Reloading via localdata again, balloons memory out of control.
Any guidance here is greatly appreciated!
Thank you!
Hello robf,
I tested this example and it seems to work fine.
Also, you could see the same example in this place as a result only.
The data is updated as you describe in thesource.localdata
viaupdatebounddata
method.
Could you clarify it?Best Regards,
Hristo HristovjQWidgets team
https://www.jqwidgets.comHello Hristo,
Thanks for your response. To further clarify the issue please look at one of your demos here: https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxgrid/index.htm#demos/jqxgrid/loadfromtable.htmWith this page initially open Chrome task manager shows about 60,000K. After several clicks of the “Load jqxgrid from table” button the memory quickly grows. I then added a simple test in the chrome console to mimic a “realtime” app and fire the click event every second, as such:
myinterval = setInterval(function(){ $('#loadButton').click(); }, 1000);
With the page in focus I continue to see memory rise for this simple load operation – 60mb, 70, …200mb. Very rarely releasing memory via GC.
Also keep in mind that the grid I’m using has cell renderers which I assume adds to memory.
In my situation I am updating grid every 10-20 seconds; when leaving the page open for 2+ hours the memory can bloat to 500+mb; overnight and it crashes the browser,
Does this help clarify the situation?
Please let me know if you can shed any more light on this.
Thanks!
RobHello Rob,
For this example, it invokes ‘properties change handler’ with each one click of the button.
This example is not appropriate for the mentioned in your case scenario.
I suggested you the right way to update the jqxGrid with “updatebounddata” method in the previous example.
Please, let me know if you met this issue in your case if you use the mentioned approach.
Meanwhile, I will discuss this case with our example with my colleagues.Best Regards,
Hristo HristovjQWidgets team
https://www.jqwidgets.comHi Hristo,
I am updating grid
myGridSource.localdata = mynewdata;
$(‘#mygrid’).jqxGrid(‘updatebounddata’, ‘cells’);Is this not the correct way? Update localdata and then ‘updatebounddata’? I’m not sure I follow what you’re suggesting. I certainly have to refresh localdata first, right?
If you speak to you colleagues about memory please let me know.
Thanks!Hi Hristo,
Is there been any more info on this?
Thanks.
RobHello Rob,
You could find more details about this in our API Documentation page:
https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-api.htm?search=gridBest Regards,
Hristo HristovjQWidgets team
https://www.jqwidgets.com -
AuthorPosts
You must be logged in to reply to this topic.