0

I have a data source with over 10,000 records. And I want to implement lazy loading with JqGrid. This is my approach:

  1. Back-end: SQL stored procedure to select data by page, page size, where expression and sort(order by) expression.
  2. Font-end: send request to get data to Web Method (web service) with: page, page size, where expression, sort expression.
  3. JqGrid: load data to jqGrid

Here is the main issue: - I can't overwrite the page count, records count of jqGrid. e.g. The pager info always display [page 1 of 1] and [records 1-50 of 50] if page = 1 and page size = 50. - Thus, I can't use the paging button of jqGrid

I thought about implement custom paging infor (pages, records, paging button) but it will take time and effort. So it's better to reuse jqGrid paging, isn't it?

Does this approach good enough? Or what I need to improve?

Update: I tried to implement json reader at Can I implement lazy loading with jqGrid? but no luck.

If I need to update any information, please tell me.

Thanks in advance.

Community
  • 1
  • 1
Vu Nguyen
  • 3,605
  • 3
  • 22
  • 34
  • Look at [the answer](http://stackoverflow.com/a/19321839/315935) which provides an example of implementation of sorting and paging in STORED PROCEDURE. If the pager info always display [page 1 of 1] and [records 1-50 of 50] then your server returns wrong (always `1`) value of `page` property of the server response. It's better that you include JavaScript code which you use to create the grid. – Oleg Oct 14 '13 at 07:57
  • Sorry for later answer, currently I have over 20,000 records to render on jqGrid. If I return a list of object-oriented, it takes tons of time to render. Fortunately, if I return a list of flat object, it only take ~4 second to load. So no need to lazy loading at the moment. – Vu Nguyen Nov 01 '13 at 03:12
  • 1
    @Vu Nguyen - I am having a similar problem, would you please elaborate on what you mean by "Return a list of flat object"? – Anand Vyas Nov 19 '14 at 07:49
  • @AnandVyas: there are 2 ways to make it work. 1st is return shallow properties of your object. 2nd is create another DTO object. Example, Person entity has Name property (string), Phone property (string) and Address entity (which has City, Province, etc). For 1st way, you just return Name and Phone only if you only need 2 of them (no Address). For 2nd way, you will have PersonDTO object has Name, Phone, City and Province as well as others. 2nd way is a bad way. But it is the only way I can find. – Vu Nguyen Nov 20 '14 at 01:40

0 Answers0