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
hi, I use this plugin in my application and I find that if I call plugin without config 'sortList' , just like $("table").tablesorter({}), and then click header with MultiSortKey (like shift), $.tablesorter.defaults.sortList is changed to the be the current sort column's index and order.
In my application, I need to reset the table. So in this state if I do it, the table will have the default sort order. I think it's unexpected.
The reason are array is reference type and $.extend is not recursive by default , so they are the same reference, the same array, if change one, another one will be changed.
And in L778, config.sortList is changed and the default is changed too.
I think you can use $.extend with deep = true or give the settings.sortList a default value, an empty array to fix it.
Good Day! : )
The text was updated successfully, but these errors were encountered:
hi, I use this plugin in my application and I find that if I call plugin without config 'sortList' , just like
$("table").tablesorter({})
, and then click header with MultiSortKey (like shift),$.tablesorter.defaults.sortList
is changed to the be the current sort column's index and order.In my application, I need to reset the table. So in this state if I do it, the table will have the default sort order. I think it's unexpected.
I check the code of plugin. In jquery.tablesorter.js L711, it call $.extend.
if settings don't have a sorList,
config.sortList
will be$.tablesorter.defaults.sortList
.The reason are array is reference type and $.extend is not recursive by default , so they are the same reference, the same array, if change one, another one will be changed.
And in L778,
config.sortList
is changed and the default is changed too.I think you can use $.extend with deep = true or give the settings.sortList a default value, an empty array to fix it.
Good Day! : )
The text was updated successfully, but these errors were encountered: