简体   繁体   English

使用datatables jquery插件和早午餐会降低性能

[英]slow performance using datatables jquery plug in and brunch

So i am using Brunch as a framework for the front end of a web application. 所以我将Brunch用作Web应用程序前端的框架。

And what I am doing is drawing each row of a table as a view and then converting the table to datatables. 我正在做的是将表的每一行绘制为视图,然后将表转换为数据表。

I need to have each row as a view for certain ui reasons. 由于某些ui原因,我需要将每一行都作为一个视图。

However, performance slows down considerably after 1000 rows. 但是,性能在1000行之后会大大降低。

any ideas of how i can do some kind of clever pagination or defer drawing each row of the table until later or some other idea where i can still have each row of the table as a separate view. 关于如何执行某种聪明的分页或将绘图的每一行推迟到以后的任何想法,或以后仍然可以将表格的每一行作为单独视图的其他想法。

Yes, use bDeferRender - in your options : 是的,在您的选项中使用bDeferRender

bDeferRender: true

From the docs : 文档

Deferred rendering can provide DataTables with a huge speed boost when you are using an Ajax or JS data source for the table. 当您为表使用Ajax或JS数据源时,延迟呈现可以为DataTables带来巨大的速度提升。 This option, when set to true, will cause DataTables to defer the creation of the table elements for each row until they are needed for a draw - saving a significant amount of time. 设置为true时,此选项将导致DataTables推迟为每一行创建表元素,直到需要绘制时才这样做-节省了大量时间。

For me, it works both when inserting rows by ajax or "native"(the table is static). 对我来说,当用ajax或“ native”(表是静态的)插入行时,它都起作用。 I have no problem with 10000 rows on a paginated table when using bDeferRender . 使用bDeferRender时,分页表上的10000行没有问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM