0

I am changing from addrowdata to addjsondata for getting e better performance in grids with more than 20 rows the problem that addjsondata is given is that if I pass an array of rowdata more than 20 rows it adds only the first 20 rows.

version in use is 4.4.5

eKelvin
  • 921
  • 1
  • 9
  • 25

1 Answers1

1

I recommend you to use either toppager: true or pager parameter to display the pager. jqGrid always makes paging. Default value of rowNum parameter is 20 (see "Default" column in the table here). So jqGrid displays the first page (20 rows) even is the user don't see any pager which allows him to change the page.

So you should use rowNum parameter with some large enough value (like rowNum: 10000) or use toppager or pager parameter parameter (or both) to display the pager which allows the user to change the page.

Finally I would recommend you to use data parameter with datatype: "local" to create the grid together with the data instead of usage addRowData or addJSONData. In the way you will fill the data and display the first page of sorted data. Don't forget to include gridview: true in the list of the options which you use (see the answer). If you need to refill (replace) the data of the local grid you can use clearGridData, set new value of data parameter using setGridParam and finally calls .trigger("reloadGrid") to reload the grid.

Community
  • 1
  • 1
Oleg
  • 220,925
  • 34
  • 403
  • 798
  • That resolved the strange behavior, anyway regarding the performance I can't use the gridview: true options because I use afterinsertrow :(. I don't know what else can I do. I measured with a speed test class that makes average and in average and in my case the use of data + reloadGrid was a little bit slower than addRowData or addJSONData. I don't know the reason. Any other suggestion for the performance issue: Average execution across 3: 29647.666666666668 with 120 rows :( – eKelvin Jul 25 '14 at 14:38
  • @ZeroAbsolute: You should not use `afterinsertrow`. If you post the corresponding code fragment then I would show you the better alternative. If you fill the grid with 120 rows (and how many columns???) in 3 sec then you have chosen a wrong way. The best would be the full demo with the code and the test data (120 rows). – Oleg Jul 25 '14 at 15:10
  • I don't know if I can post the code here due to company restrictions but we are using the custom mode for the fields in colmodel because we are doing cell advanced formatting and unless you did some changes in the 4.6.0. the software is an accounting software so formatting the values is very important. we use the afterinsertrow for doing manual formatting because if the field has a visual format specified we should format it before showing it to the user attaching the real value as .data() to the cell. – eKelvin Jul 26 '14 at 10:27
  • just to be precise if it was 3 secs was ok but it last 29 secs. – eKelvin Jul 26 '14 at 10:36