Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Mat Murdock on Jul 14, 2008 12:22
open dhtmlx forum
Get cell_id and data instead of row_id and data

When using the data processor with the grid it is my understanding that sends the row_id and then all of the values in each column for the row. Is there a way for it to just send the cell id, that could be included in the xml file, and the data instead?

Thanks,

Mat
Answer posted by Support on Jul 15, 2008 01:35
There is no support for such functionality.
Instead of using dataprocessor, you can have custom onEditCell handler code attached to grid, which will send data to server with necessary params.
Answer posted by Mat Murdock on Jul 15, 2008 08:20
If my XML looked something like this:

<?xml version="1.0"?>
<rows>
<head>
<column width="120" align="left" sort="str">Name</column>
<column width="30" align="center" sort="str">P</column>
<column width="30" align="center" sort="str">I</column>
<column width="30" align="center" sort="str">A</column>
<column width="30" align="center" sort="str">C</column>
<column width="100" align="center" sort="str">Citizenship</column>
<column width="50" align="center" sort="str">%</column>
<column width="90" align="center" sort="str">Grade</column>
<column width="100" align="center" sort="str">AR-4/1</column>
<column width="100" align="center" sort="str">C-4/3</column>
<column width="100" align="center" sort="str">C-#1</column>
<column width="100" align="center" sort="str">C-4/7</column>
<column width="100" align="center" sort="str">C-#2</column>
<afterInit>
<call command="splitAt"><param>8</param></call>
</afterInit>

</head>
<row id="100173">
    <cell type="ro">John Doe 1</cell>
    <cell type="ro">P</cell>
    <cell type="ro">I</cell>
    <cell type="ro">A</cell>
    <cell type="ro">C</cell>
    <cell type="ed">CIT</cell>
    <cell type="ro">86.40</cell>
    <cell type="ro">B</cell>
    <cell id="382584" type="ed">10</cell>
    <cell id="382659" type="ed">10</cell>
    <cell id="382823" type="ed">7</cell>
    <cell id="383043" type="ed">9</cell>
    <cell id="383134" type="ed">8</cell>
   
</row>
<row id="100839">
    <cell type="ro">John Doe 2</cell>
    <cell type="ro">P</cell>
    <cell type="ro">I</cell>
    <cell type="ro">A</cell>
    <cell type="ro">C</cell>
    <cell type="ed">CIT</cell>
    <cell type="ro">83.40</cell>
    <cell type="ro">B</cell>
    <cell id="382593" type="ed">10</cell>
    <cell
id="382668" type="ed">10</cell>
    <cell id="382832" type="ed">8</cell>
    <cell id="383052" type="ed">9</cell>
    <cell id="383143" type="ed">9</cell>
</row>
</rows>

                   
How would you suggest I get the id number in the cell field?  Thanks for you time.
                   
Answer posted by Support on Jul 15, 2008 09:55
>>How would you suggest I get the id number in the cell field?
The next can be used to save values of changed cells

grid.attachEvent("onEditCell",function(stage,id,ind,value){
    if (stage==2){
         // after cell edit end
        var cell=grid.cells(id,ind);
        var cell_id = cell.getAttribute("id");
        if (cell_id){
             //if cell id defined - call server side script
             (new dtmlXMLLoaderObject()).loadXML("some.php?cellid="+cell_id+"&value="+encodeURIComponent(value));
        }
    }
    return true;
});
Answer posted by Mat Murdock on Jul 15, 2008 10:54
Thanks,

Mat