javascript - Rebuild element in jQuery vs. mass showing/hiding -


I have a paged table of data that I want to cache client side and I am trying to explain How to switch pages efficiently.

Would it be better to do this:

A DOM

  var page Lang = 50 to reconstruct and replace the table through an amendment; Var cache; // array of some objects from the Database Object Changes page (index) {var $ table = $ ("<"> table & gt;); $ .each (cache, function (i, line) {var $ tr = $ ("& lt; tr>"); if (i> l $ .hide (); $ $ Tr.append ($ ("& lt; td & gt;", {text: row.Name})); $ table attached ($ tr);}); $ ("# TargetDiv") HTML ($ table). }   

or

b. DOM

  The function is showing and hiding rows after inserting the change page (index) {var $ table = $ ("# targetDiv table"); . Hide $ Table.find ("tr: visible"); $ Table.find ("tr"). Each (function (i, line) {if (i> index & amp; amp; i & lt; index + page length) $ tr.show ();}); }   

I wrote something on the first line and participated in IE8 in Chrome and found that IE was very slow, whereas Chrome had no problem. Our standard still is IE7 unfortunately, so I am trying to optimize the potential event according to the poor performance of IE engine in IE7 compared to IE8.

I will make a combination of both of them.

On the load you will display the page one (anywhere in the context of the list stored in your full list).

When the page two is requested, you will populate it with two data in two pages and hide the page.

When page 2 is requested a second time, it will already populate, so it will be a hidden / show function.

This can be best controlled by a class who knows which page is current, how many pages can be, etc. Then when you can manage some smart memory, where you can clear the page, away from the current page

But I would advise to use the existing solution

Many client side paging plugins, especially for jQuery.

  • Something that I used in the past and while it is a bit of a struggle to start.
  • Here's a Google that guides me

    I will have to go with an existing solution and not here try to invent the wheel again.

Comments

Post a Comment

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -