Server-side paging problem

My paging works only on the client side. The grid should send posStart and count parameters in a request but it doesn not. The grid loads all data in the first request.

[code]

     var gridQString = "/Projekt/GetGrid";
     
     var mygrid = new dhtmlXGridObject('products_grid');
     
     mygrid.setImagePath("<%= Url.Content("~/content/dhtmlx/imgs/") %>");
     mygrid.setHeader("Id,Nazov,Oz,Datum");
     mygrid.setInitWidths("50,*,100,100");
     mygrid.setColAlign("center,left,center,center");
     mygrid.setColSorting("server,server,server,server");
     mygrid.setSkin("dhx_skyblue");
     mygrid.setColTypes("ro,ro,ro,ro");

     mygrid.enableColumnMove(true);
     
     mygrid.attachEvent("onBeforeSorting",sortGridOnServer);
     
     mygrid.attachHeader("#text_search,#text_search,#text_search,#text_search");
     
     mygrid.init();
     
     mygrid.enablePaging(true, 10, 5, "pagingArea", true, "infoArea");
     mygrid.setPagingSkin("bricks");
     
     mygrid.load(gridQString,"json");
     
     function sortGridOnServer(ind,gridObj,direct){
          
          mygrid.clearAll();
          mygrid.load(gridQString+(gridQString.indexOf("?")>=0?"&":"?")+"orderby="+ind+"&direct="+direct,"json");
          mygrid.setSortImgState(true,ind,direct);
          return false;
      }
     
     
 </script>[/code]

I found an example of where the paging is happening server side as I need it.

dhtmlx.com/docs/products/dhtmlxG … aging.html

The part where the paging is set looks exactly as mine does. Am I missing something ?

Your client side is correct. If you can find example of server side of this example at your dhtmlxGrid package dhtmlxGrid\samples\14_loading_big_datasets\php\

The grid should send posStart and count parameters in a request but it doesn not
Please check if you have attached dhtmlxgrid_json.js file to your page.

I’ve attached dhtmlxgrid_json.js but it didn’t helped.

The parameters are still missing in the request.

I have these js files on my page now

dhtmlxcommon.js
dhtmlxgrid.js
dhtmlxgrid_pro.js
dhtmlxgridcell.js
dhtmlxgrid_srnd.js
dhtmlxgrid_filter.js
dhtmlxgrid_pgn.js
dhtmlxgrid_json.js

Try to delete dhtmlxgrid_pro.js file and check if dhtmlxgrid.js is a file from PRO version.

It’s corect. But I Firuged out the paging is working. When I send from the server only 10 records for the first page, the following requests will contain the appropriate parameters for paging. The problem ist with the first request. This request is omiting the piging paramters.

I tried following:

mygrid.load(gridQString + "?posStart=0&count=10","xml");

The first page got loaded properly. But when I clicked for the second page the grid started to send one request after another. Like a endless loop.

BTW the second request was corect.

I noticed the second request isn’t correct.

It looks like this.

http://localhost:4883/Projekt/GetGrid2?posStart=0&count=10&posStart=10&count=10

And the grid keeps sending this request in an endless loop.

Your code works as expected at the local example. What version of dhtmlxGrid do you use? Try to update your files to the latest version.

dhtmlxGrid v.2.6 Professional edition build 100722

Please open ticket at support.dhtmlx.com/ and we will provide you working example.