Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Anya on May 11, 2009 11:48
open dhtmlx forum
dhtmlx cell

Hello...
I have a grid like this:

function InitPageGrid(nodeId){
             gridP = new dhtmlXGridObject('for_grid');
             gridP.setImagePath("css/images/");
                gridP.setSkin("light");
                gridP.setNoHeader(true);
                gridP.init();
                gridP.loadXML("db/dataprocessor/get.php?object=page&id="+nodeId);
                gridP._key_events.k46_0_0=function() {
                            if(!this.editor && this.row) this.deleteRow(this.row.idd);
                            else return false;
                        }    
                dhxDataProcessor = new dataProcessor("db/dataprocessor/update.php?object=page");
                dhxDataProcessor.setTransactionMode("POST");
                dhxDataProcessor.enableDataNames(true);                
                dhxDataProcessor.enableDebug(true);
                dhxDataProcessor.init(gridP);
                

            }


The code to generate xml:

echo "<head>";
    echo " <column width='170' type='ro' align='left' sort='str' id='name'>".FIO_STUDENT."</column>";
    $sql="select * from lessons where si_id=".$id;
    $arrays_in=cdb_query_array($sql);
    for ($j=0; $j<count($arrays_in); $j++){
        echo " <column width='70' type='ed' align='right' sort='str' id='l".($j+1)."'>".LESSON."#".($j+1)."</column>";    
    }
    
    echo "</head>";    

    echo "<row id='title' style='background-color:#518ED7;color:white'>";
    echo "<cell><![CDATA[".TOPIC."]]></cell>";
    for ($j=0; $j<count($arrays_in); $j++){
        echo "<cell id='".$arrays_in[$j]['l_id']."'><![CDATA[".$arrays_in[$j]['l_topic']."]]></cell>";
    }
    echo "</row>";
    echo "<row id='date' style='background-color:#7BAEE9;color:white'>";
    echo "<cell><![CDATA[".DATE."]]></cell>";
    for ($j=0; $j<count($arrays_in); $j++){
        echo "<cell id='".$arrays_in[$j]['l_id']."'><![CDATA[".$arrays_in[$j]['l_date']."]]></cell>";
    }
    echo "</row>";

    $sql="select * from student where gro_group_id in (select group_id from journal_page where si_id=".$id.")";
    $arrays=cdb_query_array($sql);
    for ($i=0; $i<count($arrays); $i++){
        echo "<row id='".$arrays[$i]['s_id']."'>";
            echo "<cell><![CDATA[".$arrays[$i]['s_surname']." ".$arrays[$i]['s_name']." ".$arrays[$i]['s_lastname']."]]></cell>";
            for ($j=0; $j<count($arrays_in); $j++){
                echo "<cell id='".$arrays_in[$j]['l_id']."'><![CDATA[1]]></cell>";        
            }
        echo "</row>";
    }        


So to update the cell I need to know rowId and cellId... Is it possible using Dataprocessor to get in php script not only gridId (rowId) but also cellID of the updated cell??? Thank you...     
Answer posted by dhxSupport on May 12, 2009 01:49
You can use dp.enableDataNames(true) mode. In such case dataProcessor will send colum id's instead of c0-cN. 
on the server side:
$_GET['c0'] ⇒ $_GET['name']
$_GET['c1'] ⇒ $_GET['second column id']
Answer posted by an4ous on May 12, 2009 10:20
Thank you very very much...

I use foreach to get the key value in server side code like this:

foreach($_POST as $key => $value){
        if (is_numeric($key)){
           .......
        }
    }


Thank's a lot