How to sort multiple datatables by field that have select inside?
How to sort multiple datatables by field that have select inside?
ipechepare
Posts: 1Questions: 1Answers: 0
Hi guys!
I can´t share a Url because the website is private of my company.
I try to explain my problem. I have multiple data tables generate like this:
comparables_table_list = $('#comparables-table-list').DataTable({
paging: false,
info: false,
"sDom": '<"top"i>rt<"bottom"l><"clear">',
"order": [[8, "asc"]],
"aoColumns": [
{ "bSortable": false },
null,
null,
null,
null,
null,
{"sType": "numeric"},
null,
{"sType": "numeric"},
{"sType": "numeric"},
{ "orderDataType": "dom-select" }
]
});
$.each(COMPS_TYPES, function( index, value ) {
var type = value.SUB_TYPE;
comparables_table_list_land[type] = $('[data-type="'+type+'"]').DataTable({
paging: false,
info: false,
"sDom": '<"top"i>rt<"bottom"l><"clear">',
"order": [[8, "asc"]],
"aoColumns": [
null,
null,
null,
null,
null,
{"sType": "numeric"},
null,
{"sType": "numeric"},
{"sType": "numeric"},
{ "orderDataType": "dom-select" }
]
});
});
And I use that to sort by field that have a select inside:
$.fn.dataTable.ext.order['dom-select'] = function ( settings, col )
{
return this.api().column( col, {order:'index'} ).nodes().map( function ( td, i ) {
return $('select', td).val();
} );
};
But when I try to sort by this field I can't If I have only a table them all work well.
Sorry form my poor english and I wait for yours answers, thanks!!
This discussion has been closed.