Inserting a row into a DataTable with a remote DataSource
- Hi All,
I have a paged DataTable, and have made a Dialog that pops up when clicking on a row. The Dialog is populated with the contents of the row that was clicked, and on submission sends the update back to the server.
I'm wanting to implement a button to add a new row of data to the table.
The way I was thinking this might work is to:
- Tell the Paginator to go to page 1.
- Insert a new row into the DataTable at position 0.
- Open the editing Dialog, populated with empty values.
I've managed the first two by subscribing to the postRenderEvent of the DataTable and checking to see if an insert is pending (made a bool for this), otherwise the inserted row would get overwritten when the data for that page came back.
The third part is where I am stuck. I've tried to fire the onRowClickEvent, but can't seem to pass in a reference to the newly created row.
It'd be great if somebody could offer me some advice on this. Or even tear my idea to shreds, and offer a better way :)