优化 YUI 数据表中多行的删除
删除操作似乎是 YUI 数据表中最慢的。 我有一个数据表 > 300 行。 我需要删除选定的行。 我尝试从 recordset
中删除选定的记录,然后调用 table.render()
。虽然这没问题,但可以做得更好吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
查看有关数据表小部件的“deleteRow”方法的 API 文档(位于 http://developer.yahoo.com/yui/docs/YAHOO.widget.DataTable.html#method_deleteRow)。 在我看来这就是你想要的。 也许是这样的:
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:
不,这比我写的慢。
在这里,您逐行删除,并且每次都必须重新渲染数据表。
我所做的就是从记录集中删除这些记录,然后渲染数据表一次。
那更快,但不是很多。
No. This is slower than what I wrote.
Here you delete row by row and each time datatable has to be re-rendered.
What I did was remove these records from he recordset and then render the datable once.
Thats faster, but not a whole lot.
据我所知,这是从 yui 数据表中删除行的最快方法。 但是,为了您的用户的利益,除非需要 300 行,否则您应该考虑在 2.6.0 版本中改进的分页(并且已被拆分出来,现在可以在其他对象上使用,而不仅仅是 DataTable)。
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).