Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by tabassum on Dec 29, 2008 03:43
open dhtmlx forum
Dhtmlx grid add row manually

Hi i want to populate the dhtmlx grid manually fro example my grid has got popultated with NoData.xml file on page load, onc ethe page gets loaded the user edits the cell in the grid

NoData.xml

<?xml version="1.0" encoding="UTF-8"?><rows>
<head>
<column id='col1' width="*" type="ed" align="left" >column #1</column>
</head>
<row id="some1">
<cell id='c1'>No data</cell>
</row>
</rows>


mygrid1.attachEvent("onXLE",function(){
document.body.style.cursor="default";
this.entBox.style.cursor='default'; });
mygrid1.loadXML("../NoData.xml");
mygrid1.attachEvent("onXLE",function(){
if(mygrid1.getRowsNum()==0){mygrid1.clearAll();mygrid1.loadXML("../NoConData.xml");} });

the user edits the cell c1 and enters the data needed now i want to add another row with different id and enter the celll value in the 2 row. can you suggets me how to do this..



Answer posted by Support on Dec 29, 2008 16:42
Please beware that
a) second call on attachEvent will not override previously assigned event
b) the command called after loadXML may be executed before data really loaded in grid ( loading is async )

>>the user edits the cell c1 and enters the data needed now i want to add another row with different id and enter the celll value in the 2 row.
mygrid.attachEvent("onEditCell",function(stage,id,ind){
     if (stage == 2 ){
          mygrid.addRow(mygrid.uid(),"some value");
     }
      return true;
});