Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Joan on Feb 09, 2009 15:59
open dhtmlx forum
Problem with smart rendering

I am trying to use the Grid to display some records in smart rendering mode.
But I can only see the first load. If I scroll down and try to load more data, the new data can be requested and received, but can not be displayed in the grid window. If I scroll back to the top, sometimes, the original data disappear too.

I am wondering if I missed anything. Your help is really appreciated.

I am using version 2.0. and my javascript looks like:
var mygrid;

function doInitGrid(){
mygrid = new dhtmlXGridObject('mygrid_container');

mygrid.setImagePath("/dhtmlxGrid/codebase/imgs/");


mygrid.setSkin("light");
mygrid.init();
mygrid.enableSmartRendering(true, 50);
mygrid.xmlFileUrl = "dataload.jsp";
mygrid.loadXML("dataload.jsp");


}
the xml looks like:
<rows pos="50" total_count="3081">
<head>
<column align="left" sort="int" type="link" width="75">Tsnid</column>
<column align="left" sort="str" type="ro" width="150">ScientificName

</column>
<column align="left" sort="str" type="ro" width="150">CommonName</column>
<column align="left" sort="int" type="ro" width="75">ParentTsnid</column>
<column align="left" sort="str" type="ro" width="35">Source</column>
<column align="left" sort="str" type="ro" width="75">RankName</column>
<column align="left" sort="str" type="ro" width="150">AuthorName</column>
<column align="left" sort="str" type="ro" width="150">ItisStatus</column>
<column align="left" sort="str" type="ro" width="150">Expert</column>
<column align="left" sort="date" type="ro" width="0">ExpertDate</column>
<column align="left" sort="str" type="ro" width="150">Action</column>
<column align="left" sort="int" type="ro" width="150">Approved

</column>
<column align="left" sort="date" type="ro" width="0">ApprovalDate</column>
<column align="left" sort="str" type="ro" width="150">Status</column>
<column align="left" sort="int" type="ro" width="0">Rowindex</column>
</head>

<row class="New" id="row51">
<cell>15741^javascript:queryNewTaxonInfo(15741)
;^_self</cell>
<cell>Sphagnum girgensohnii</cell>
<cell>Girgensohn's moss</cell>
<cell>15683</cell>
<cell>ITIS</cell>
<cell>Species</cell>
<cell>Russ.</cell>
<cell>accepted</cell>
<cell>system</cell>
<cell>2009-01-20 11:11:53.0</cell>
<cell>created</cell>
<cell/>
<cell/>
<cell>New</cell>
<cell>51</cell>
</row>

<row class="New" id="row52">
<cell>15742^javascript:queryNewTaxonInfo(15742);^_self</cell>
<cell>Sphagnum fimbriatum</cell>
<cell>fringed bog moss</cell>
<cell>15683</cell>
<cell>ITIS</cell>
<cell>Species</cell>
<cell>Wils. in Wils. & Hook. f. in Hook. f.</cell>
<cell>accepted</cell>
<cell>system</cell>
<cell>2009-01-20 11:11:53.0</cell>
<cell>created</cell>
<cell/>
<cell/>
<cell>New</cell>
<cell>52</cell>
</row>

</rows>
Answer posted by dhxSupport on Feb 10, 2009 08:31
Please check if you have been included "dhtmlxgrid_srnd.js". If issue still occurs please provide to the support@dthmlx.com sample with this issue.
Answer posted by Joan on Feb 10, 2009 08:47

Thanks for your quick response.

I did include dhtmlxgrid_srnd.js. If not, I will receive a javascript error says "enablesmartrender" is not defined.

 

Answer posted by Support on Feb 10, 2009 09:43
>> the new data can be requested and received, but can not be displayed in the grid window
a) Check the response generated by server side, it must contain valid pos@rows  value , the grid will use value of pos attribute as start point for row insertion , so if it points to incorrect place - rows will be inserted incorrectly. 

b) Please be sure that <head> section of XML loaded only for initial data request, if it will be included in response for additional data request - it will cause full grid reconfiguration , which is unnecessary in your case. 

c) If you are using custom skin or some external styles affect height of grid's row, position in grid can be calculated incorrectly. ( can be fixed by direct usage of grid.setAwaitedRowHeight  ) 
Answer posted on Feb 10, 2009 10:32
Excellent!
b) is the solution. I did include <head> section in all xml returns.

Thank you very much. Great technical support.