Reputation: 19033
I am using jqgrid with local data and I know how to edit a row, but I can't figure out how to delete or insert a row.
For insert, where do I need to place addRowData
? In some event handler?
Upvotes: 0
Views: 111
Reputation: 38147
Use the following as an example :
var myfirstrow = {invid:"1", invdate:"2007-10-01", note:"note", amount:"200.00", tax:"10.00", total:"210.00"};
jQuery("#grid_id").addRowData("1", myfirstrow);
where invid
,invdata
,note
,amount
,tax
and total
are column names and #grid_id
is the ID of your jqGrid to add data and
jQuery("#grid_id").delRowData( rowid );
where rowid
is the ID of the row you want to remove
Docs for these methods are here
To trigger the adding / removing of rows is really your choice - you could have an add button and then prompt the user to enter the column data - then add the data to the table ....
Upvotes: 1