开发者

Using a plugin vs manually populating a table with Jquery

开发者 https://www.devze.com 2023-01-30 13:50 出处:网络
I am contemplating between using a grid plugin for Jquery vs manually adding rows to the html table (using Jquery). All I need to do is display the data in a table, have one field editable, then save

I am contemplating between using a grid plugin for Jquery vs manually adding rows to the html table (using Jquery). All I need to do is display the data in a table, have one field editable, then save the data to the database. i have a limited deadline and don't have the time to learn a new plugin (such as jqgrid which is quite complex).

I would normally display around 200 rows to the user..what I am wondering about is in terms of speed would it be really poor performance to add row to the html table 200 times? Would a plugin really speed up the performance (hence making it almost necessary for me to use one)? I know JavaScript can be slow开发者_JAVA技巧 when not optimized which is why I would like to know.

Any thoughts/advice?


There is nothing that a plugin does that would necessarily be faster than what you can write yourself.

That being said, the fastest way to do this for you would be to create a string of the HTML table rows (append each row to the string) and then to set the innerHTML to the string. Don't build the DOM nodes directly & append, that is the worst performance.

Source: http://www.quirksmode.org/dom/innerhtml.html


Look at examples from the answer. In the example will be added 1000 lines to the grid and all work quickly.

It would be much better if you posted the prototype of your grid which you currently use. Moreover jqGrid support many scenarios for local and remote data and many ways of editing local and remote data. Do you choosed already one way or at least direction in which you want to go? If you plan to access remote backend server having database, more information is required. At least one need to know which technology you use on the server (ASP.NET MVC, WFC, ASMX web services, PHP, Java Servlet and so on).

0

精彩评论

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