Searching, Sorting slow with datatable 1.10.4

Searching, Sorting slow with datatable 1.10.4

amitsinghamitsingh Posts: 1Questions: 0Answers: 0

Hello All,
below is my js code for data table

if (myTable != null) {
myTable.destroy();
}
$.ajaxSetup({ cache: false });
myTable = $('#myTable').DataTable({
"processing": true,
"serverSide": true,
"pagingType": "simple_numbers",
"searching": true,
"autoWidth": false,
"ajax": function (data, callback, settings) {
settings.jqXHR = $.ajax({
'dataType': 'json',
'type': 'POST',
'url': '/Location/GetAll',
'data': data,
'success': function (data) {
if (data == '-501') {
LogOut();
}
$('#GridChk_hdr').prop("checked", false);
callback(data);
},
'error': function (data) {
LogOut();
}

                    });
                },
                "columns": [
                    { "data": "Check", "orderable": false, "width": "2%", 'class': "center" },
                    { "data": "LocationName", "width": "20%" },
                    { "data": "City", "width": "20%" },
                    { "data": "State", "width": "20%" },
                    { "data": "Country", "width": "20%" },
                    { "data": "Edit", "orderable": false, "width": "2%", },
                    { "data": "Delete", "orderable": false, "width": "2%", }
                ],
                "order": [[1, 'asc']],
                "language": {
                    "info": "_START_ to _END_ of _TOTAL_",
                    "lengthMenu": "SHOW _MENU_",
                    "infoEmpty": "0 to _END_ of _TOTAL_",
                    "paginate": {
                        "previous": "<i class='fa fa-lg fa-arrow-circle-left'></i>",
                        "next": "<i class='fa fa-lg fa-arrow-circle-right'></i>",
                    },
                    "processing": "<i class='fa fa-3x fa-spinner fa-spin' style='z-index:5; color:#313131';></i>"
                }
            });

I have only 4-5 record in tables even though my searching and sorting are very slow, I am new to datatable don't know much about it if something is miss configured so please help me out in this.

Thanks,

Replies

  • gigabajtgigabajt Posts: 1Questions: 0Answers: 0

    I am using datatables 1.10.5 and have a similar problem. I've tried with two different search methods, and both completely freeze my browser (Chrome, FF) after 2-3 strokes (especially when using backspace to correct the string). The search code is the following:

        $('#table_search').on( 'keyup', function () {
            table.search( $(this).val() ).draw();
    

    {# table.columns(0).search($(this).val()).draw();#}
    } );

    It looks like there are memory leaks here, Chrome starts using >3GB of ram after a few tries of this search.

  • allanallan Posts: 63,210Questions: 1Answers: 10,415 Site admin

    Please link to a test case showing the issue.

    Allan

This discussion has been closed.