Delayed initialization #66

MelTraX opened this Issue May 7, 2012 · 4 comments


None yet

2 participants


Sorry for spamming all these issues but these are things I changed myself in an older version of tablesorter and I thought maybe others can benefit from them aswell.

I have quite a few huge tables on my project which take a considerable time initializing (the tablesorter constructor; especially in IE < 8 :( ). So I made the constructor only register the click handler on the headers and the cache and other stuff is only done after the first click to sort the table.

Obviously the first click is then delayed a bit and that probably shouldn't be the default behaviour. But in my project sorting isn't used very much and the tables are huge, so I rather like the quicker load times.

I could just call the entire constructor onclick but then I would have to do the header parsing myself and unregister the handler and stuff.

Since it's pretty easy to implement I would say it's a nice addition to the options but if you don't want it in your version just close the issue. Then I'll find a solution that works just for me. :)


Hmm, so instead of initialization taking a long time, the first sort takes a lot of time... it wouldn't be noticeable for small tables, but I'm not sure I like the idea. Too bad HTML5 web workers haven't been around since IE7... LOL.

Wouldn't the situation you described be better handled by paging the table? I've tried to modify the pager plugin to better work with ajax, but I have limited experience with server side interactions so I may not have covered everything.

Let me think about it, maybe just adding an option to initialize the table on first sort might work.


Sure, pagination would be another solution but that has other drawbacks like no search. For me that's not going to happen because I would have to completely restructure many working pages.

I will delay the initialization no matter what you do but I just thought it might be a good addition to the "semi-"official version. :)


Ok, an option named delayInit was added in version 2.3.


This issue should be resolved now. I was thinking I'd like to learn how to use HTML5 web workers and have that method process the data in the background, but that will be way in the future and may only be necessary for tables with a lot of data - which isn't always the case.

I'm going to go ahead and close this issue. Thanks for the enhancement suggestion, I hope it works well for you :)

@Mottie Mottie closed this May 15, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment