开发者

Should i pre-initialize a JQuery datatable?

I'm using JQuery Datatables and i'm wondering, for efficiency sake, if I should initialize the Datatable when the page loads. Then when the user submits their query, call the datatable API to addData?

Alternatively i could just initialize the 开发者_开发技巧DataTable with the server query string.


If there is a chance that the table will not be used on the page then initializing it on page load will be a waste and might slow down the page load.

However, if the initialization takes a significant amount of time and you don't want the user to wait for it to display the data, you could start initializing as soon as the user's query is submitted. This will take advantage of the time you will be spending waiting for a reply from the server. You might need a flag to show if the table is finished initializing once you're ready to display the returned data.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜