Data table taking too much time to load all data because I have too much data,

Data table taking too much time to load all data because I have too much data,

preetam232preetam232 Posts: 1Questions: 1Answers: 0
edited September 2022 in Free community support

I am using PHP for server side
I have 8000 records, I am first render the records and then appy datatable code

jQuery(document).ready(function(){
        var table;
        dataTableMethod();
        function dataTableMethod(){
            table  = jQuery("#personListed").DataTable({
            //data: <%-JSON.stringify(data.table)%>,
            order: [[ 0, "asc" ]], 
            searching: true,
            paging: true,
            lengthMenu: [[20, 50, 100, 500, 1000, -1], [20, 50, 100, 500, 1000, "All"]],
            ordering: true,
        
            responsive: true,
    
            dom:\'<"top_table_toolbar"lf>tp\',
            language: {
                    "processing":   "1",
                    "lengthMenu":   "2",
                    "zeroRecords":  "3",
                    "emptyTable":  "4",
                    "info": "5",
                    "infoEmpty":    "6",
                    "infoFiltered":" 7",
                    "infoPostFix":  "",
                "search": "_INPUT_",
                    "searchPlaceholder":       "8",
                    "url":          "",
                    "paginate": {
                        "first":    "9",
                        "previous": "10",
                        "next":     "11",
                        "last":    "12"
                    },
                    "regex": false,
                    "smart": false,
                    "oSearch":{"bSmart":false}
            }
            });
        }
        
            jQuery(".searching").on("change", function(){
                dataCol = jQuery(this).data("column");
            //alert(dataCol);
                var filtervalue = this.value;

                table
                .column(dataCol)
                .search(filtervalue)
                .draw();
            
            });
            jQuery("#clearmethod").on("click", function(){
              table.columns().search("").draw();
              jQuery(".Searchgrid-item .searching").val("");
              jQuery(".Searchgrid-item .searching").select2({});
            });
});

Edited by Colin - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.

Answers

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

    8k records isn't that large, so it shouldn't be a problem. When you say it's running slow, how long does it take to render? Also, have you profiled the issue? You're not loading the data with ajax, so something else is retrieving the data first - are you certain that it's not that process that's delaying the load?

    Colin

Sign In or Register to comment.