Problem using 'hidden title sort' to sort images - Easy question
Problem using 'hidden title sort' to sort images - Easy question
Hi!
I am trying to sort a image by the title, but it does nothing!
The title attribute is changed realtime by JS (I use node.js to retrieve events from server)
So, the title starts the same for every row, but then, it changes in some seconds after and keep changing everytime.
How can I make this happens dinamically?
I tried setting "sSortDataType" to "dom-image" and "dom-img" but it still does nothing...
I also tried the plugin for "alt-string" but no luck.
Here is my js code:
[code]
jQuery.extend( jQuery.fn.dataTableExt.oSort, {
"title-string-pre": function ( a ) {
return a.match(/title="(.*?)"/)[1].toLowerCase();
},
"title-string-asc": function ( a, b ) {
return ((a < b) ? -1 : ((a > b) ? 1 : 0));
},
"title-string-desc": function ( a, b ) {
return ((a < b) ? 1 : ((a > b) ? -1 : 0));
}
} );
jQuery('#example').dataTable({
"bPaginate":false,
"bLengthChange":false,
"bFilter":true,
"bSort":true,
"bInfo":false,
"bAutoWidth":false,
"sDom": '<"toolbar">frtip',
"aoColumns": [
{"sType": "title-string"}, {"bSortable": false}, {"bSortable": false}, {"bSortable": false}, {"bSortable": false}, {"bSortable": false},
{"bSortable": false},{"bSortable": false},{"bSortable": false},{"bSortable": false},{"bSortable": false}
]
}); [/code]
And here is my html code and how I change it afterwards after recieving an event from node.js:
[code]
//The TD that I want to sort is the first one (index 0, id=tdStatus+aux)
I am trying to sort a image by the title, but it does nothing!
The title attribute is changed realtime by JS (I use node.js to retrieve events from server)
So, the title starts the same for every row, but then, it changes in some seconds after and keep changing everytime.
How can I make this happens dinamically?
I tried setting "sSortDataType" to "dom-image" and "dom-img" but it still does nothing...
I also tried the plugin for "alt-string" but no luck.
Here is my js code:
[code]
jQuery.extend( jQuery.fn.dataTableExt.oSort, {
"title-string-pre": function ( a ) {
return a.match(/title="(.*?)"/)[1].toLowerCase();
},
"title-string-asc": function ( a, b ) {
return ((a < b) ? -1 : ((a > b) ? 1 : 0));
},
"title-string-desc": function ( a, b ) {
return ((a < b) ? 1 : ((a > b) ? -1 : 0));
}
} );
jQuery('#example').dataTable({
"bPaginate":false,
"bLengthChange":false,
"bFilter":true,
"bSort":true,
"bInfo":false,
"bAutoWidth":false,
"sDom": '<"toolbar">frtip',
"aoColumns": [
{"sType": "title-string"}, {"bSortable": false}, {"bSortable": false}, {"bSortable": false}, {"bSortable": false}, {"bSortable": false},
{"bSortable": false},{"bSortable": false},{"bSortable": false},{"bSortable": false},{"bSortable": false}
]
}); [/code]
And here is my html code and how I change it afterwards after recieving an event from node.js:
[code]
//The TD that I want to sort is the first one (index 0, id=tdStatus+aux)
This discussion has been closed.