Closed driscojs closed 10 years ago
Hi @driscojs!
Hmm, all that code looks like the exact same as from the jsFiddle. Can you provide a demo of this issue? I do wonder if there is some other code on your page that is interfering.
Happy to supply whatever I can. How would you like me to demo it to you? I can take some screenshots if that’s all you need. I’m not sure about getting access to our site, A: it’s a dev site, B: it’s locked to our logins.
I can give you the source view easily enough if that’s good enough.
[cid:image001.jpg@01CF1296.7E1F7960]
Jeff Driscoll | IT Manager Office: 800-939-5938 x104 | Mobile: 540-271-6709 jdriscoll@marketing-mojo.commailto:jdriscoll@marketing-mojo.com
From: Rob G [mailto:notifications@github.com] Sent: Friday, April 04, 2014 3:07 PM To: Mottie/tablesorter Cc: Jeff Driscoll Subject: Re: [tablesorter] Always sorts using the last column (#569)
Hi @driscojshttps://github.com/driscojs!
Hmm, all that code looks like the exact same as from the jsFiddle. Can you provide a demo of this issue? I do wonder if there is some other code on your page that is interfering.
— Reply to this email directly or view it on GitHubhttps://github.com/Mottie/tablesorter/issues/569#issuecomment-39600178.
Yeah, I know that makes it more difficult. I don't think screenshots would help in this case. I guess what I'm asking is can you duplicate the problem in a jsFiddle demo?
If not, then I would think that there is some other function bound to the table. So, you could start by disabling blocks of unrelated code to see if this issue resolves.
Another thing you could do is look to see what events are bound to the table cell. If you are using a newer version of jQuery, type the following into the console and you should see the result below:
// enter this into the console (check both the :first and :last th's)
jQuery._data( $('th:first')[0], 'events' );
// this should be the "standard" result
Object {keyup: Array[1], sort: Array[1], mouseup: Array[1], mousedown: Array[1], selectstart: Array[1]}
> keyup: Array[1]
> mousedown: Array[1]
> mouseup: Array[1]
> selectstart: Array[1]
> sort: Array[1]
> __proto__: Object
If you see more or less events than those shown above, then there might be other code interfering. You should be able to click on the triangle (shown as >
above) in the console to expand each object for more details.
I entered that console command and got exactly what you listed below for both first and last. We’re on 1.5.2 for jQuery it appears. As for jsFiddle, I copied that code out exactly, since I thought it might be our code as well.
I attached the view-source of our page, maybe it’ll help. ☺
In case it matters, I just tried with jQuery 1.11 as well, similar results.
[cid:image001.jpg@01CF1296.7E1F7960]
Jeff Driscoll | IT Manager Office: 800-939-5938 x104 | Mobile: 540-271-6709 jdriscoll@marketing-mojo.commailto:jdriscoll@marketing-mojo.com
From: Rob G [mailto:notifications@github.com] Sent: Friday, April 04, 2014 4:11 PM To: Mottie/tablesorter Cc: Jeff Driscoll Subject: Re: [tablesorter] Always sorts using the last column (#569)
Yeah, I know that makes it more difficult. I don't think screenshots would help in this case. I guess what I'm asking is can you duplicate the problem in a jsFiddle demohttp://jsfiddle.net/Mottie/abkNM/?
If not, then I would think that there is some other function bound to the table. So, you could start by disabling blocks of unrelated code to see if this issue resolves.
Another thing you could do is look to see what events are bound to the table. If using a newer version of jQuery, type the following into the console and you should see the result below:
// enter this into the console (check both the :first and :last th's)
jQuery._data( $('th:first')[0], 'events' );
// this should be the "standard" result
Object {keyup: Array[1], sort: Array[1], mouseup: Array[1], mousedown: Array[1], selectstart: Array[1]}
keyup: Array[1]
mousedown: Array[1]
mouseup: Array[1]
selectstart: Array[1]
sort: Array[1]
proto: Object
If you see more or less events than those shown above, then there might be other code interfering. You should be able to click on the triangle (shown as > above) in the console to expand each object for more details.
— Reply to this email directly or view it on GitHubhttps://github.com/Mottie/tablesorter/issues/569#issuecomment-39606288.
Hmm, one more thing to try... Enter the following into your console:
$('table').trigger('sorton', [[[0,0]]]);
And see if the first column sorts. If it does, I'm not sure what else to tell you beside time to dig through the other code on the page.
Rob,
When I paste that code into the console, it sorts like one would expect. When I change the first digit to 2,0 or 1,0, the corresponding columns sort just fine. Any clue what’s going on?
[cid:image001.jpg@01CF1296.7E1F7960]
Jeff Driscoll | IT Manager Office: 800-939-5938 x104 | Mobile: 540-271-6709 jdriscoll@marketing-mojo.commailto:jdriscoll@marketing-mojo.com
From: Rob G [mailto:notifications@github.com] Sent: Friday, April 04, 2014 7:36 PM To: Mottie/tablesorter Cc: Jeff Driscoll Subject: Re: [tablesorter] Always sorts using the last column (#569)
Hmm, one more thing to try... Enter the following into your console:
$('table').trigger('sorton', [[[0,0]]]);
And see if the first column sorts. If it does, I'm not sure what else to tell you beside time to dig through the other code on the page.
— Reply to this email directly or view it on GitHubhttps://github.com/Mottie/tablesorter/issues/569#issuecomment-39621519.
Well it sounds like tablesorter is set up properly.
The only thing I can think of is that there might be some header cell element being repositioned using css or javascript, or maybe there is content being added using a :before
or :after
css definition that is covering up header cells. To troubleshoot this, try right-clicking on any of the header cells and "Inspect element" (in Chrome). When you hover over the elements in the development window, it highlights that element on the web page so you can tell if there is any overlapping going on. You can even click on the :after
pseudo element in Chrome and see it on the web page.
If that isn't the issue, then I don't think I can be of more help unless I saw the page itself. Maybe you can set me up with a temporary user account - I only need to see it, so I don't need any admin privileges.
Rob,
You can reach the page I’m testing on at http://dashdev.search-mojo.com/tablesorterTest
It’s a basic Codeigniter controller with only one function, the index, and that only loads the view. All js, html, css is in the view. We do have a custom base controller, but I’m just extending the CI_Controller directly for this page. I appreciate all the help!
[cid:image001.jpg@01CF1296.7E1F7960]
Jeff Driscoll | IT Manager Office: 800-939-5938 x104 | Mobile: 540-271-6709 jdriscoll@marketing-mojo.commailto:jdriscoll@marketing-mojo.com
From: Rob G [mailto:notifications@github.com] Sent: Monday, April 07, 2014 12:11 PM To: Mottie/tablesorter Cc: Jeff Driscoll Subject: Re: [tablesorter] Always sorts using the last column (#569)
Well it sounds like tablesorter is set up properly.
The only thing I can think of is that there might be some header cell element being repositioned using css or javascript, or maybe there is content being added using a :before or :after css definition that is covering up header cells. To troubleshoot this, try right-clicking on any of the header cells and "Inspect element" (in Chrome). When you hover over the elements in the development window, it highlights that element on the web page so you can tell if there is any overlapping going on. You can even click on the :after pseudo element in Chrome and see it on the web page.
If that isn't the issue, then I don't think I can be of more help unless I saw the page itself. Maybe you can set me up with a temporary user account - I only need to see it, so I don't need any admin privileges.
— Reply to this email directly or view it on GitHubhttps://github.com/Mottie/tablesorter/issues/569#issuecomment-39750009.
Ok, that is very odd.
I did replace the version of tablesorter that was there (v2.15.11) with the latest (v2.15.13) and everything started working - there was an issue with v2.15.11 where the cell indexing was undefined (see #554) and causing problems.
Also, the pager plugin isn't being used on that demo page, but it appears to be the same pager plugin provided with v2.0.5b on tablesorter.com. Please update this version if you plan to use the pager. And I wouldn't recommend using the metadata plugin unless you plan to use it. Everything in tablesorter can now be done using data-attributes.
Rob,
Excellent! I’ll give it a try this morning.
The pager is probably left in when I copied and pasted, just a silly oversight. The meta, I think I didn’t understand how to use it. Thanks for educating me! Also, thanks for all the patience and troubleshooting!
[cid:image001.jpg@01CF1296.7E1F7960]
Jeff Driscoll | IT Manager Office: 800-939-5938 x104 | Mobile: 540-271-6709 jdriscoll@marketing-mojo.commailto:jdriscoll@marketing-mojo.com
From: Rob G [mailto:notifications@github.com] Sent: Monday, April 07, 2014 6:39 PM To: Mottie/tablesorter Cc: Jeff Driscoll Subject: Re: [tablesorter] Always sorts using the last column (#569)
Ok, that is very odd.
I did replace the version of tablesorter that was there (v2.15.11) with the latest (v2.15.13) and everything started working - there was an issue with v2.15.11 where the cell indexing was undefined (see #554https://github.com/Mottie/tablesorter/pull/554#issuecomment-39078308) and causing problems.
Also, the pager plugin isn't being used on that demo page, but it appears to be the same pager plugin provided with v2.0.5b on tablesorter.com. Please update this version if you plan to use the pager. And I wouldn't recommend using the metadata plugin unless you plan to use it. Everything in tablesorter can now be done using data-attributes.
— Reply to this email directly or view it on GitHubhttps://github.com/Mottie/tablesorter/issues/569#issuecomment-39792509.
The metadata plugin allows you to set headers
options as a header class name.
So instead of using this method:
headers: {
0: { sorter: false }
}
You can use the metadata plugin like this:
<th class="{ sorter: false }"></th>
The above were the only two options available in the original tablesorter. In this forked version, you can add a class name
<th class="sorter-false"></th>
or use a data-attribute:
<th data-sorter="false"></th>
The priority of these setting is data-attribute, metadata, header option then class name (see this demo for more details)
I’m glad to report all is well now. Just have to figure out how to hide a disabled filter on one column! Everything is sorting like it should!
[cid:image001.jpg@01CF1296.7E1F7960]
Jeff Driscoll | IT Manager Office: 800-939-5938 x104 | Mobile: 540-271-6709 jdriscoll@marketing-mojo.commailto:jdriscoll@marketing-mojo.com
From: Rob G [mailto:notifications@github.com] Sent: Tuesday, April 08, 2014 10:28 AM To: Mottie/tablesorter Cc: Jeff Driscoll Subject: Re: [tablesorter] Always sorts using the last column (#569)
The metadata plugin allows you to set headers optionshttp://mottie.github.io/tablesorter/docs/#headers as a header class name.
So instead of using this method:
headers: {
0: { sorter: false }
}
You can use the metadata plugin like this:
The above were the only two options available in the original tablesorter. In this forked version, you can add a class name
or use a data-attribute:
The priority of these setting is data-attribute, metadata, header option then class name (see this demohttp://mottie.github.io/tablesorter/docs/example-parsers-class-name.html for more details)
— Reply to this email directly or view it on GitHubhttps://github.com/Mottie/tablesorter/issues/569#issuecomment-39854259.
Good to hear! To hide a disabled filter, use this css:
.tablesorter-filter.disabled {
display: none;
}
Already did. :) It worked nicely and we’ve rolled it out to users.
[cid:image001.jpg@01CF1296.7E1F7960]
Jeff Driscoll | IT Manager Office: 800-939-5938 x104 | Mobile: 540-271-6709 jdriscoll@marketing-mojo.commailto:jdriscoll@marketing-mojo.com
From: Rob G [mailto:notifications@github.com] Sent: Tuesday, April 08, 2014 4:52 PM To: Mottie/tablesorter Cc: Jeff Driscoll Subject: Re: [tablesorter] Always sorts using the last column (#569)
Try:
.tablesorter-filter.disabled {
display: none;
}
— Reply to this email directly or view it on GitHubhttps://github.com/Mottie/tablesorter/issues/569#issuecomment-39900297.
I'm guessing this issue has been resolved, so I'm going to close it. If you continue to have problems, please feel free to continue this discussion.
When I put a tablesorter into any table, and click on a column header, it always sorts the final column, instead of that column. I created a test page, and loaded the code straight from the jfiddle provided, and still got the same result. After the page loads, and then I click the 'Numeric' column header, then ctrl-clicking to clear the sort (which does clear it) then I clicked'Animals', this is the console log:
The sort seems to be always sorting the 4th column, #3 of 0-3. Here's the code I'm using:
Controller:
View:
Apologies if this has been asked already, I swear I looked all over and didn't find it.
I'm trying to implement tablesorter on our internal website, and I'm working with a Codeigniter setup that I didn't create and that programmer is gone, so that might be an issue.
Jeff