Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Gayathri on Dec 07, 2007 08:58
open dhtmlx forum
Externally setting cell value,update not fired

Hi,
I am setting the value for a cell externally in JS. But the dataprocessor doesnt recognise this as a changed row and hence sendData() is not fired. What should i do to send this row for saving to the server. The solution is of lot of help to me..
Thanks.
Answer posted by Support on Dec 07, 2007 09:37
This is correct behavior , by default dataProcessor react only on cell which was changed by direct user actions.
To mark cell as updated you can use code similar to next


mygrid.cells(rowId,cellIndex).setValue(new_one);   //set new value
dataProcessor.setUpdated(rowId,true);   //inform dataprocessor about data update
Answer posted on Dec 10, 2007 08:06

Thank for your help. It works!

Gayathri.

Answer posted by Prasad on Dec 11, 2007 02:04
Hi,
I also face the same problem. But i am not using dataprocessor.
so how to mark cell as updated?
Answer posted by Support on Dec 11, 2007 04:11
The updated flag of cell can be set as
var ed=mygrid.cells(rowId,cellIndex);
    ed.setValue(new_one);   //set new value
    ed.cell.wasChanged=true; //set updated flag
Answer posted by Lisa on Dec 26, 2007 19:45
Hi, I am trying to implement the same functionality as the above. What I have encountered is a little different. I have a checkbox which is set at the header of one column, when this is checked, all the checkboxes in the column will be checked. So what I have done is I have outputed a checkbox in the header using this
mygrid.setHeader("PK,<input type='checkbox' id='batchCheck' onChange='checkAllRow(this.value);'/>,Quickname,Name,City,Customer Ref,Consignment #,Delivery Instruction");
And then wrote a javascript function. For testing purposes I have hard coded it to be the first row
function checkAllRow(checkboxValue){
        var edRow =mygrid.cells('r0',1);
        mygrid.cells('r0',2).setValue('test');
        edRow.setValue(1);   //set new value
        edRow.cell.wasChanged=true
        myDataProcessor.setUpdated('r0',true);
       
    }

There is one issue with the display/refresh which I couldn't figure out, once I click on the checkbox in the header, nothing happens in the grid from display perspective, but if I click my mouse anywhere with inthe grid area, the first row's checkbox is checked and the cell value is changed as well, is there some sort of refresh function that need to call on the grid to redisplay or refresh?