Datat Table Fix Column

Datat Table Fix Column

hadinajafi1984hadinajafi1984 Posts: 1Questions: 1Answers: 0

hi
datatable in server side mode sort an search not working after enable fixcolumn column .
please help me.
Table = $('#tbl').DataTable({
"processing": true,
dom: 'Blfrtip',
"scrollY": 200,
"scrollX": true,
fixedHeader: true,
"fixedColumns": {
"leftColumns": 2
},
orderable: true,
"serverSide": true, // for process server side
"filter": true, // this is for disable filter (search box)
//"orderMulti": true, // for disable multiple column at once
"formatNumber": function (toFormat) {
return toFormat.toString().replace(
/\B(?=(\d{3})+(?!\d))/g, "'"
);
},
"ajax": {
"url": '@Url.Action("Loaddata", "Sale")',
"type": "POST",
"datatype": "json",
"data": {
'Status': 1
}
},
"initComplete":LisIinitComplete,
"lengthMenu": [10, 25, 50, 75, 100],
"Search": "Quick Search:",
"columns": [
{ "data": "ID", "name": "ID", "autoWidth": true, "className": "d-none" },
{ "data": "No", "name": "ProformaNo", "autoWidth": true },
{ "data": "CustomerID", "name": "CustomerID", "autoWidth": true, "className": "d-none" },
{ "data": "CustomerCode", "name": "CustomerCode", "autoWidth": true, "className": "d-none"},
{ "data": "CustomerName", "name": "CustomerName", "autoWidth": true, "className": "d-none"},
{ "data": "CustomerFamily", "name": "CustomerFamily", "autoWidth": true, "className": "d-none"},
{ "data": "RejectDescription", "name": "RejectDescription", "autoWidth": true }
],
buttons: [
{
extend: 'pdfHtml5',
orientation: 'landscape',
pageSize: 'LEGAL',

                },
                'copy', 'excel', 'csv',
                {
                    extend: 'print',
                    text: 'Print',
                    exportOptions: {
                        modifier: {
                            selected: null
                        }
                    }
                }
            ]
        });

Answers

  • kthorngrenkthorngren Posts: 20,318Questions: 26Answers: 4,772

    You have "filter": true, // this is for disable filter (search box). This not only disables the search box but also the searching function. See the searching docs. You can remove the search input by using the dom option.

    I'm not sure about sorting, don't see anything obvious. We will need a link to you page or a test case replicating the issue in order to help debug. What happens when you try to sort? Do you get errors in the browser's console? Do the sort arrows change? Is there a request sent to the server for the sorted data? What is the server's JSON response?

    Also note that the FixedHeader docs state this:

    Please note that FixedHeader is not currently compatible with tables that have the scrolling features of DataTables enabled (scrollX / scrollY). Please refer to the compatibility table for full compatibility details.

    Using FixedHeader and FixColumns (and scrolling features) are not compatible.

    Kevin

This discussion has been closed.