Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tigger('update') even w/resort is not updating zebra #243

Closed
TheSin- opened this issue Feb 21, 2013 · 5 comments
Closed

tigger('update') even w/resort is not updating zebra #243

TheSin- opened this issue Feb 21, 2013 · 5 comments

Comments

@TheSin-
Copy link
Collaborator

TheSin- commented Feb 21, 2013

I have lots of tables in my app using v2.7.9 and when I use ajax to populate my table in the ajax I run an update, well now I run lots and I can not get the zebra to update I have to physically click a sort to fix it.

ie:

in my $.ajax{ success:

I have as the last line

var resort = true;
$('#table').trigger('update', [resort]).trigger('appendCache').trigger('filterEnd');

It is doing the resort but the zebra is not working, looks at the results odd and even are not being applied to the table rows. I can just do this by hand by doing.

$('#table tbody tr:odd').addClass('odd');
$('#table tbody tr:even').addClass('even');

but this doesn't seem right. Is this a bug or have I not found the right event to trigger?

@TheSin-
Copy link
Collaborator Author

TheSin- commented Feb 21, 2013

More debugging it seems like adding

$.tablesorter.refreshWidgets($('#table'), true, false);

returns

TypeError: 'undefined' is not an object (evaluating 'c.widgets')

So maybe it because I'm using id tables? Just using this for my notes.

@TheSin-
Copy link
Collaborator Author

TheSin- commented Feb 21, 2013

Figured it out, the table was hidden, I only showed it when I was done, since it was hidden all rows where so none got zebra. Sorry to waste your time.

@Mottie
Copy link
Owner

Mottie commented Feb 21, 2013

Hey The-Sin!

No worries! I actually had a hard time with this too... see issue #224.

Also, the refresh widgets function only takes a DOM element, not a jQuery object... I'll work on making either work in the next update.

// parameters: table, doAll, dontapply
$.tablesorter.refreshWidgets( $('#table')[0], true, false );

@TheSin-
Copy link
Collaborator Author

TheSin- commented Feb 21, 2013

good to know and thanks for this amazing pluggin, it just keeps getting better and better! I love it!

@Mottie
Copy link
Owner

Mottie commented Feb 21, 2013

My pleasure! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants