Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Muhammad Jafer on Jan 15, 2010 05:18
open dhtmlx forum
SmarRendering Problem

Hi Guys,
I am having problem with smartrendering, What happens is that only first 10 rows are shows after wards the grid stops working. Following is the code that i am trying to run

XML - FILE (php file)

<?php
    error_reporting(E_ALL ^ E_NOTICE);
    
    if ( stristr($_SERVER["HTTP_ACCEPT"],"application/xhtml+xml")) {
        header("Content-type: application/xhtml+xml"); } else {
        header("Content-type: text/xml");
    }
    if(!isset($_GET["count"]))
        $_GET["count"]=10;
    if(!isset($_GET['posStart']));
        if(!isset($_GET['posStart']))
        $_GET["posStart"]=0;    
    echo("<?xml version='1.0' encoding='iso-8859-1'?>\n");
?>
<rows pos="<?php echo $_GET['posStart'];?>" total_count="598000">
<?php
        echo "<head>\n";
        echo "<column width=\"*\" height=\"80px\" type=\"ro\" align=\"center\" sort=\"str\">Destination</column>";
        echo "<column width=\"150\" type=\"ro\" align=\"center\" sort=\"int\">Dial Prefix</column>";
        echo "<column width=\"60\" type=\"ro\" align=\"center\" sort=\"int\">SR</column>";
        echo "</head>";
            for($i=0; $i<$_GET['count']; $i++){print("<row id='r".($i+$_GET['posStart'])."'><cell>".$i."</cell><cell>index is ".($i+$_GET['posStart'])."</cell><cell>load turn started from ".$_GET['posStart']." + ".$_GET['count']."</cell></row>");
            }
    ?>
</rows>


File Containing Script

<div id="gridbox" style="width:600px;height:250px;background-color:white;"></div>
<br>
<script>mygrid = new dhtmlXGridObject('gridbox');
mygrid.setImagePath("../old_codebase/imgs/");
//mygrid.setSkin("dhx_skyblue");

mygrid.loadXML("dynload.php");
mygrid.enableSmartRendering(true, 50);
</script>

Please help me in this regard. I would be waiting for your response

Regards
Muhammad Jafer
Software Engineer
http://xeeonix.com
Answer posted by Alex (support) on Jan 15, 2010 05:32

Hello, 

<head> tag should be loaded only once to configure grid. So, you can add the following check here:

...

if($_GET['posStart']==0){
  echo "<head>\n"; 
  echo "<column width=\"*\" height=\"80px\" type=\"ro\" align=\"center\" sort=\"str\">Destination</column>"; 
  echo "<column width=\"150\" type=\"ro\" align=\"center\" sort=\"int\">Dial Prefix</column>"; 
  echo "<column width=\"60\" type=\"ro\" align=\"center\" sort=\"int\">SR</column>"; 
  echo "</head>"; 
  }

...