1

I am heavily using jqGrid on a web page, using local data (array of data) The grid is having hundreds of rows (maybe up to 300 rows), and around 40 columns.

And there is a requirements that the user when click a button, it will update one columns for all rows. so which is faster? using setCell and call it for all rows? or update the back data, and do reloadgrid? our application is going to be used by hundreds of users.

Ghassan Karwchan
  • 3,355
  • 7
  • 37
  • 65

1 Answers1

1

I'm sure that reloading of modified data should be much quickly as typical update of 300 cells with respect of setCell. The web browser have to make reflow of the whole grid or the whole page on update of one cell. So it's expensive not just updating of cells, but the consequences of the update (the reflow). So I would recommend you to use reloadGrid. I'm sure that you use gridview:true option (if you don't want to make the page in many many times slowly).

In general it would be possible to implement much more quick changes of multiple cells of grid. In the case one would need to temporary detach the grid from the page (see "Out-of-the-flow DOM Manipulation" part here), make the modifications and restore the grid on the original place. The way would be tricky and I'm not sure that you could use setCell in the case.

Community
  • 1
  • 1
Oleg
  • 220,925
  • 34
  • 403
  • 798
  • Thanks a lot Oleg You helped me before and you are doing it again. – Ghassan Karwchan Dec 05 '14 at 14:43
  • @gkar: You are welcome! Do you use `gridview: true` option? How long time take the filling of new grid (reloadGrid) in your tests? – Oleg Dec 05 '14 at 14:45
  • Yes, I use it. even I don't know exactly why I should use it , but I know it is something to do with loading. do you have any documentation on that? I am still in development phase and I tried it with 4400 records / 20 columns and it is reloading fast (less than 1-2 seconds) But I have my own machine which is fast, and powerful, and testing on our development server. maybe in two weeks we are moving to QA where we can do load testing with QA machines which are less powerful (similar to usual clients machines) and I can update you with more info – Ghassan Karwchan Dec 05 '14 at 14:57
  • @gkar: default value of `gridview` is `false` only for compatibility to very old versions. Only if one uses `afterInsertRow` it is required. In case of usage `gridview: false` jqGrid place every row (´´) separately. So one have reflow of the page after inserting of every row on the page. In case of usage `gridview:true` the whole `` with all rows will be first corrected as a string and then be inserted as *one operation*. So only one reflow will be done. I would recommend you to display the value of `totaltime` parameter of jqGrid which hold the time of filling the grid in ms. – Oleg Dec 05 '14 at 15:05