Add New Row to SlickGrid -
hi have tried these 2 codes inserting new row in slickgrid.
code-1:
data1.push({id: "12345", name: "seckey", field: "seckey", complete:true}); //grid1.setdata(data1); //grid1.render();
it inserting undefined in slick grid cell..
code-2:
try{ var rowdata = grid1.getdata(); //alert(rowdata+"rowdata"); newid = dataview1.getlength(); //alert(newid); newrow.id = newid + 1; //alert(newrow.id); var newrow = {title: "new title"}; //alert(newrow); dataview1.insertitem(newrow.id, newrow); alert("end"); }catch(e){ alert("error:"+e.description); }
the code-2 catches , gives error..let me know wat have code change.!
you can follows if using dataview,
function addnewrow() { dataview.additem({id: "12345", name: "seckey", field: "seckey", complete:true}); dataview.refresh(); }
or can follows if not using dataview,
function addnewrow() { grid.getdata().splice(grid.getdatalength(), 1, {}); grid.invalidaterow(grid.getselectedrows()); grid.updaterowcount(); grid.render(); }
Comments
Post a Comment