Hello, On 20 aug, 11:33, lukek <[EMAIL PROTECTED]> wrote: > By the way I had another question. -- In the unpacked version of the > latest script your comment on line 555 says "apply easy methods that > trigger binded events". > > Does this mean I can insert function calls in here - ie around line > 560? > > I say this because I have added a call to applyWidget() as I reckon > all the widgets should be reloaded when the update event is triggered > - eg after I insert rows I want to reapply the zebra widget.
I'm not sure if this helps anyone, but as this thread gave some pointers for my issue, here goes: I also wanted to reapply the zebra widget each time I add rows to the table. However in my case the rows are coming from an AJAX query, similar to http://tablesorter.com/docs/example-ajax.html The example there just applies a defined sorting when new data arrives with triggering "sorton" (after "update") - this will also reapply the zebra from the sort operation. However I didn't want to loose the sorting that the user might have had already changed to, away from the default, and I wanted the arriving data to get sorted into the pre- existing data according to the sort selection. I didn't find a good way to get to the configuration saved, so I just ended up with this: $("table").trigger("update"); var current_sort = $("table.tablesorter").get(0).config.sortList; $("table").trigger("sorton", [current_sort]); Hopefully there already is (that I don't know of yet), or will be, a good way to keep the sorting selection in tact. Maybe something like this in tablesorter2 itself: $this.bind("resort", function(e) { // update header count index updateHeaderSortCount(this,sortList); //set css for headers setHeadersCss(this,$headers,config.sortList,sortCSS); // sort the table and append it to the dom appendToTable(this,multisort(this,config.sortList,cache)); }); Some of these calls (like setHeadersCss) is probably not necessary from just a resort, as everything in the headers remains the same. Best Regards, Mart Raudsepp