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
Is it possible to set the "data-sortvalue" value dynamically?
As in, pass in a call to a javascript function, e.g. <td data-sortvalue="textToNumber('Text')">Text</td>
where the textToNumber() function converts text to a value used in sorting?
The text was updated successfully, but these errors were encountered:
You can set the data-sortvalue value with JavaScript using the dataset document.querySelector("#my_table_cell").dataset.sortvalue = "somevalue"
or using jQuery attr $("#my_table_cell").attr("data-sortvalue","somevalue")
You can also hijack the sort function and write your own sort function not limited to the data-sortvalue attribute
$("#your_table").fancyTable({
sortFunction: function(a, b, fancyTableObject, rowA, rowB){
// your custom sort logic
},
// more settings
})
Closing this ticket since it is not an fancyTable issue.
Is it possible to set the "data-sortvalue" value dynamically?
As in, pass in a call to a javascript function, e.g.
<td data-sortvalue="textToNumber('Text')">Text</td>
where the
textToNumber()
function converts text to a value used in sorting?The text was updated successfully, but these errors were encountered: