Not able to use multi Column search
Not able to use multi Column search
kumar_endeavour
Posts: 5Questions: 3Answers: 0
I have created my data table using ajax, following is my code
$(document).ready(function() {
$('#tabledata tfoot th').each( function () {
var title = $('#tabledata thead th').eq( $(this).index() ).text();
$(this).html( '<input type="text" placeholder="Search '+title+'" />' );
} );
var table=$("#tabledata").dataTable( {
"bProcessing": false,
"iDisplayLength": 15,
"sAjaxDataProp": "",
"bSearchable": true,
"scrollCollapse": true,
"paging": true,
"bServerSide": false,
"sAjaxSource": "viewOrder.do?method=listOfOrders",
"bJQueryUI": true,
"aoColumns": [
{ "mData": "orderId"},
{ "mData": "orderType"},
{ "mData": "status"}
]
} );
table.columns().every( function () {
var that = this;
$( 'input', this.footer() ).on( 'keyup change', function () {
that
.search( this.value )
.draw();
} );
} );
} );
when i run the code it says table is undefined.
Please suggest me how to do this
This discussion has been closed.
Answers
First thing to do is to use:
See the second top FAQ for why.
Secondly, if that doesn't work, please link to a test page showing the issue, per the forum rules.
Allan