You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm attempting to sort a single column in descending order when the page loads. I noticed that unless I manually define $.tablesort.defaults, asc and desc in $.tablesort.settings are reversed from what they should be.
Here's what my init code looks like:
Note asc: "sorted descending" and desc: "sorted ascending:".
Now, if I include the following in my <script> tag, asc and desc are set to what they should be:
$.tablesort.defaults = {
debug: true,
asc: 'sorted ascending',
desc: 'sorted descending',
compare: function (a, b) {
if (a > b) {
return 1;
} else if (a < b) {
return -1;
} else {
return 0;
}
}
};
Note that this is a direct copy and paste from the source code (aside from debug).
Additionally, I noticed that changing the values in $.tablesort.defaults in the source file doesn't change $.tablesort.settings like it should. I'm not setting the defaults anywhere else in my code.
I've been trying to figure out what is overwriting the default settings, but for the life of me I can't figure it out.
This might just be me doing something incorrectly, or missing some sort of cached data, but I don't think that's happening.
I'm fine with setting the defaults in my <script> tag as a work-around, but this basic function SHOULD work. No idea why it's not. I'd love for someone to take a look.
The text was updated successfully, but these errors were encountered:
octalide
changed the title
asc and desc tags flipped unless default settings are manually definedasc and desc tags flipped unless default settings are manually defined
Jun 21, 2018
octalide
changed the title
asc and desc tags flipped unless default settings are manually defined
asc and desc tags flipped unless default settings are manually defined
Jun 21, 2018
I'm attempting to sort a single column in descending order when the page loads. I noticed that unless I manually define
$.tablesort.defaults
,asc
anddesc
in$.tablesort.settings
are reversed from what they should be.Here's what my init code looks like:
Here's console output that shows the "flip" when you don't set the default values:
Note
asc: "sorted descending"
anddesc: "sorted ascending:"
.Now, if I include the following in my <script> tag,
asc
anddesc
are set to what they should be:Note that this is a direct copy and paste from the source code (aside from
debug
).Additionally, I noticed that changing the values in
$.tablesort.defaults
in the source file doesn't change$.tablesort.settings
like it should. I'm not setting the defaults anywhere else in my code.I've been trying to figure out what is overwriting the default settings, but for the life of me I can't figure it out.
This might just be me doing something incorrectly, or missing some sort of cached data, but I don't think that's happening.
I'm fine with setting the defaults in my <script> tag as a work-around, but this basic function SHOULD work. No idea why it's not. I'd love for someone to take a look.
The text was updated successfully, but these errors were encountered: