c# - JQGrid Get page level data at a time -
currently have implemented jqgrid fetches data db , returning json data jqgrid.
jqgrid call
rownum: 10, rowlist: [5, 10], url: "/home/getdatafromentity"
data returned c#
return json(result, jsonrequestbehavior.allowget);
what trying if page has 10 records 10 records want bring db , if click next page want next 10 data because if data huge dont want bring data memmory think performance hit.
how can implement ?
thanks
this straightforward. need implement paging, asking db page of data going display. see jqgrid provide information controller can use when retrieving data.
the controller take data in via (i don't know end tech stack here c# code) this:
public actionresult griddatafetch(string sidx, string sord, int page, int rows, bool _search, string filters) { ....
then when go retreive data, can ask database page of data user wants without having retreive whole dataset. can more complicated seems basics simple somthing (again c# code)
var pagedquery = dataset.orderby(sidx + " " + sord).skip((page - 1) * rows).take(rows);
you can see above order data in manner user specified , jqgrid passed along sidx
& sord
, skip records before page interested in via skip
, , take rows
interested in. again c# method grabbing page of data basics should there setup. side note if filtering via grid, or other logic have filtered dataset prior call.
you pass paged query same in json.
Comments
Post a Comment