search each columns

search each columns

szafarszafar Posts: 12Questions: 2Answers: 0

i cant get me search each columns working i looked at some examples but with no luck it dose not works

i have the columns search boxes displayed but when i press a key nothing happends

Replies

  • kthorngrenkthorngren Posts: 21,301Questions: 26Answers: 4,946
    edited March 2018

    We can help you debug if you provide a test case showing the issue:
    https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case

    Kevin

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    As Kevin says, an example would demontrate how it doesn't work - "nothing happens" is just too vague for us to give any advice. But take a look at this example, this has individual columns searches, so may point you in the right direction.

  • szafarszafar Posts: 12Questions: 2Answers: 0
    edited March 2018

    This is my code



    <link rel="stylesheet" href="https://cdn.datatables.net/1.10.16/css/jquery.dataTables.min.css" />

    $(document).ready(function () { $.ajax({ url: 'CustomerService.asmx/GetCustomerSearch', method: 'post', dataType: 'json', success: function (data) { var dataTableInstance = $('#datatable').DataTable({ data: data, paging: false, sort: true, scrollY: "300px", scrollX: true, scrollCollapse: true, searchable: true, //fixedColumns: true, columns: [ { 'data': 'CustomerID' }, { 'data': 'CustomerFirstName' }, { 'data': 'CustomerLastName' }, { 'data': 'CustomerAddress' }, { 'data': 'CustomerCity' }, { 'data': 'CustomerPostCode' }, { 'data': 'CustomerTelephoneNumber' }, { 'data': 'CustomerMobileNumber' }, { 'data': 'CustomerEmailAddress' }, { 'data': 'AgentName' }, ] }); $('#datatable tfoot th').each(function () { var title = $('#datatable thead th').eq($(this).index()).text(); $(this).html(''); }); dataTableInstance.columns().every(function () { var datatableColumn = this; var searchTextBoxes = $(this.header()).find('input'); searchTextBoxes.on('keyup change', function () { datatableColumn.search(this.value).draw(); }); searchTextBoxes.on('click', function (e) { e.stopPropagetion(); }); }); } }); });

    data appears and the search boxes but when i click on it nothings happens on the search

  • kthorngrenkthorngren Posts: 21,301Questions: 26Answers: 4,946

    Are you also loading jquery.dataTables.js?

    If you can't provide a test case at least post your JS code showing the Datatables init code and the code for the search boxes.

    Kevin

This discussion has been closed.