gwt-material-table
gwt-material-table copied to clipboard
Unable to add and delete rows
In my program, I want to provide the ability to dynamically add and remove rows. Data is taken from database by GWT RPC. In AsyncCalback I use the code: ` @Override public void onSuccess(List<SatConfigView> result) { table.clearRowsAndCategories(true);
table.setRowData(0, result);
table.setRedraw(true);
table.refreshView();
}`
where result is the data from server. But nothing is happen - additional rows appear after reloading the page. Could you say the solution?
Best regards!
try to clear the table first and set the visible range
table.clearRows(true);
table.setVisibleRange(0, result.size());
I'm also trying to add a row to a specific index position in gwt-material-table. Is it always necassary to clear and reset all data of the table? These are always a lot of DOM operations... and it's also difficult to insert a row at a specific position when table is sorted, because everything is redrawn with that sorting when adding a row. Is there another solution for tis?
@davidmoers if you are trying to update a specific row try doing it through the model object rather than setRowData
using updateRow. However if you are trying to "insert" a row perhaps this is something that needs to be added. Inserting data requires a number of reindexing operations so rebuilding is often the way to go, but it would be possible to minimize this too.