Smart Rendering doesn't send parameters

Hi all, i am trying to use dhhtmlxGrid with his smart rendering activated. Here’s my js code

function grid() { var mygrid = new dhtmlXGridObject('products_grid'); mygrid.setImagePath("codebase/imgs/"); mygrid.setHeader("Product Name,Internal Code,Price"); mygrid.setInitWidths("*,150,150"); mygrid.setColAlign("left,left,right"); mygrid.setSkin("modern"); mygrid.init(); mygrid.enableSmartRendering(true); mygrid.load("PrendiTutto", "json"); }

In my html i have a tag that launch the application, and “PrendiTutto” is a servlet that is able to read from my database. My problem is that when the mygrid.load(“PrendiTutto”, “json”) is launched there are no parameters passed to my servlet, while i know that the smartRendering uses the “count” and “posStart” parameters. Can anyone help me?

Did you put the value for “count” and “posStart” parameters at the start of xml?, i.e.

out.println("<rows total_count='" + totalCount + "' pos='" + posStart + "'>");

Please refer to the documentation as given here. I have followed it and got it working for my grid.

http://docs.dhtmlx.com/doku.php?id=dhtmlxgrid:step_3_loading_data_server_side_support_for_smart_rendering

I hope this helps.

-Sam

I must explain better my situation… I have a servlet that returns a json, but that servlet gives me an error on loading the parameter “count” and “posStart” from the request… So it returns a json with all my database (11500 rows)… I want my smartRendering to read from the db only the rows visualized in my grid… And the more you scroll the more he read… Dunno if i explained better my situation…

“while servlet gives me an error on loading the parameter “count” and “posStart” from the request”
Please provide the error which you got.

Please note - At first time when your servlet will try to load the values for parameter “count” and “posStart” from the request, they will be null, that is why while creating your json with rows you have to check whether the values are null for parameter “count” and “posStart” or not

If they are null, then you need to specify, that how many records you want to show to the user - the value of which will be assigned to your “count” variable, thereafter both posStart and count values should be used for querying db. If your query is returning all 11500 rows from the db, then I think you are not using posStart and count parameters, in your db query, for restricting the number of records to be retrieved from db.

-Sam

I think that you might mention in your documentation and samples that for using json is necessary the dhtmlxgrid_json.js. I’ve found it on another forum and now all is running well.

Hi, pls update your docs with the information on including ext/…json.js as it is really hard to find out, that it is needed for functions like pagination and smart rendering :wink: Thanks!

Thank you.

The documentation will be updated.