Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by pepys on May 11, 2009 05:14
open dhtmlx forum
:: pepysDHTMLX :: enableSmartRendering issue

I've tried to implement step-by-step the Smart Rendering in a grid using the tutorial:

http://www.dhtmlx.com/docs/products/dhtmlxGrid/doc/step-by-step/ch_biggrid.html

Everything is ok until a moment. I've setted

if(isset($_GET["posStart"]))
$posStart = $_GET['posStart'];
else
$posStart = 0;
if(isset($_GET["count"]))
$count = $_GET['count'];
else
$count = 30;

and

    gridQString = "mygrid.php";
    mygrid.loadXML(gridQString);


and when I use this for a table, the first 30 rows is shown great,the called XML path is:

mygrid.php

After the 30th row, my grid is blank, without any rows inside, even the called XML path is right

mygrid.php?posStart=30&count=4

So what kind of problem is this? What's wrong?
Answer posted by Support on May 11, 2009 06:10
Please check response XML generated by the script ( just load the same URL in separate window ) 
Be sure that it contains correct  pos attribute
            <rows pos="SOME" >
For mygrid.php?posStart=30&count=4 it must conatain
            <rows pos="30">

Without pos attribute , xml can't be correctly mapped to the view, which will result in error similar to one in your case. 

If issue still occurs for you - please provide a sample of xml generated in problematic case. 
Answer posted by Support on May 11, 2009 06:12
By the way, you can check 
       http://dhtmlx.com/docs/products/dhtmlxConnector/index.shtml
It is a set of classes which automates xml generation
Answer posted by pepys on May 11, 2009 07:52
Thanks for your answer. You can see attached my generated .XML file for mygrid.php?posStart=30&count=4. I think the sintax is correctly, what problem can I have then?

About the DHTMLx Connector, I've tried and I think is very cool. But I'm not sure I can use it with creating the dinamic XML sintax. Do you think can I use DHTMLx Connector with this:

$strXML .= "<rows total_count='".$totalCount."' pos='".$posStart."'>";

$strXML .= "<head>";

    $strXML .= "<beforeInit>";
    $strXML .= "<call command='attachHeader'>";
        $strXML .= "<param><![CDATA[#text_filter,<input type='submit' onClick='xRefreshFilters()' value='Reset Filtre'>]]></param>";
    $strXML .= "</call>";
    $strXML .= "</beforeInit>";

    $strXML .= "<column type='ed' width='300' sort='str' id='nume'>Nume</column>";
    $strXML .= "<column type='ro' width='*' align='left' id='actiuni'>Actiuni &amp; Links</column>";

$strXML .= "</head>";


while($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) {

    $strXML .= "<row id='".$row['id']."'>";
        $strXML .= "<cell>".$row['nume']."</cell>";
        $strXML .= "<cell><![CDATA[";
           
            $strXML .= "<a href=\"edit_tabel.php?".$queryString."&id=".$row['id']."\" >edit</a> &bull; ";
            $strXML .= "<a href=\"edit_tabel.php?".$queryString."&sterge=1&id=".$row['id']."\" onClick=\"if (confirm('Confirmati stergerea?')) return true; else return false;\">delete</a>";
                                  
            eval('$strXML .= "'.$viewOptions.'";');       

           
        $strXML .= "]]></cell>";
       
    $strXML .= "</row>";
   
    }


$strXML .= "</rows>";

Attachments (1)
grid.xml3.66 Kb
Answer posted by Support on May 11, 2009 08:57
Problem caused by "head" section, each time when grid found "head" section it reset configuration to one described in XML, which switch scroll state back to the top of grid
To resolve problem , you can change your code, so <head> section output to client only when $posStart == 0

>> But I'm not sure I can use it with creating the dinamic XML sintax.
Existing version will not allow to inject "<head>" section, so this part can't be done currently by connectors.
But if you mean html links inside cell - it can be done by using custom rendering function

http://dhtmlx.com/docs/products/kb/index.shtml?cat=search&page=1&q=8912&ssr=yes&s=beforeRender


Answer posted by pepys on May 12, 2009 02:16
finally, a working answer.. thanks..