Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted on May 08, 2008 06:52
open dhtmlx forum
grid onchange event

dear support,

i am using the dhtml grid. when i enter the value in the first row first column and then only the new row will added.how can i achive this..which event i can use.. give the sample code to add one row in the grid....


thanks,

karthik
Answer posted by Support on May 08, 2008 09:45
The grid provides a rich set of events
    http://dhtmlx.com/docs/products/dhtmlxGrid/doc/events.html#grid_api_ev

I'm not sure which one is appropriate in your case, but you can use next code snippet to implement row adding on Enter key pressing
  
mygrid.attachEvent("onEnter",function(id,ind){
    if (this.getRowsNum() == (this.getRowIndex(id)+1))
       mygrid.addRow(mygrid.getUID(),[],-1);
    return true;
})

As result, pressing of enter key in last row will cause adding of new row.