Deletion operations seems to be the slowest in a YUI datatable. I have a datatable with > 300 rows. I need to delete selected rows. I tried removing the selected records from the recordset
and then calling table.render()
.. While this is okay, can it be made better?
views:
1196answers:
4
+2
A:
Have a look at the API docs on the "deleteRow" method for the datatable widget (at http://developer.yahoo.com/yui/docs/YAHOO.widget.DataTable.html#method_deleteRow). This looks to me like this is what you'd want. Perhaps something like:
var selected = theDataTable.getSelectedRows();
var rset = theDataTable.getRecordSet();
for (var x = 0; x < selected.length; x++) {
theDataTable.deleteRow(rset.getRecordIndex(rset.getRecord(selected[x]))
}
Evan Anderson
2008-12-06 20:39:31
A:
To my knowledge that is the fastest way to delete a row from a yui datatable. However, for your user's sake, unless 300 rows is necessary, you should consider pagination which is improved in version 2.6.0 (and has been split out and can now be used on other objects and not just DataTable).
Anthony Potts
2008-12-08 15:04:25