Filtering and sorting not working
Filtering and sorting not working
stefutz101
Posts: 5Questions: 1Answers: 0
Hello, I'm new into data tables, and if I try to order a column ascendent or descendent the data is reloaded but in reloaded in the same order. Same with search and filters. If I apply a filter the entire data is reloaded.
JS FILE
, columns:[ {
field:"title", title:"title", width:90, template:function(t) {
return t.title
}
} ]
- a column exemple
, sortable:!0, pagination:!0, search: {
input: $("#generalSearch"), delay: 400
}
- search input
$("#m_form_status").on("change", function() {
t.search($(this).val(), "title")
}
- filter
PS: are just parts from the file, if it´s unclear i can post the entire script.
<select class="form-control m-bootstrap-select m-bootstrap-select--solid" id="m_form_status">
<option></option>
<option value="0">FALSE</option>
<option value="1">TRUE</option>
</select>
- select element from .php file
I mention that it worked on demo data.
This discussion has been closed.
Answers
Hi @stefutz101 ,
Those code snippets are too small to make sense of, I'm afraid. If you could link to your page, or create a fiddle, that would be the most useful.
Cheers,
Colin
Hi @colin,
Thanks for your answer.
https://jsfiddle.net/bbdoosh5/
Here´s the fiddle, it hope it helps.
callback.php
DataTables expects a HTML table for its data. You don't seem to have one.
The loading part is working. The script is loading data into "#column_rendering".
My problem is that sorting and filters are not working:
Same with price and search input.
Sorting:
The table isn't shown in your JSFiddle. Can you link to a page that demonstrates the issue please?
Your JSFiddle also uses:
Are you using a library other than DataTables, or perhaps a wrapper to DataTables? DataTables doesn't provide a
mDatatable
jQuery method.As I say, we'd need a working test case that demonstrates the issue to be able to help.
Allan
Looking a bit further into it,
mDatatable
appears to be provided by the Metronic 5 theme. You'd need to contact their support about that - that's nothing to do with the library presented here.Allan