Datatables slow for typing

Datatables slow for typing

rgraves2rgraves2 Posts: 2Questions: 1Answers: 0
edited March 25 in Free community support

I have a DataTable setup that displays a large list of json records (approx 7000). It reads the file and processes it client side.

It is working fine to display the data, but when I try to type something in the search, I can type one letter, then is pauses for a few seconds before the subsequent letters I typed display in the search box. It's a noticable lag.

This is happening in Edge and Chrome. Works properly in Firefox. I am sure it was working in all browsers early on. I tried removing extra code for other things on the page and get it down to the bare essentails for the DataTable, however it still lags as I type in the search box.

$('#myTable').DataTable( {
        ajax: { url: 'path_to_json_file'},
                paging: true,
        columnDefs: [ { searchable: false, targets: ['field7', 'field8', 'field9'] },
                      { visible: false, targets: ['field4', 'field5', 'field6'] },
                      { targets: 'field1', render: function (data, type, row, meta) {
                          return '<a href="#" class="infoLink">'+ data +'</a>'
                        }
                      }
                    ]
        });
});

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,489Questions: 1Answers: 10,470 Site admin
    Answer ✓

    Can you link to the page so I can profile it please.

    Allan

  • rgraves2rgraves2 Posts: 2Questions: 1Answers: 0
    edited March 26

    I'm unable to post the URL since it's not public data I can share, however I ended up setting a searchDelay and that solved the problem. It's not noticable now.

  • allanallan Posts: 63,489Questions: 1Answers: 10,470 Site admin

    Cool - thanks for letting me know.

    Allan

Sign In or Register to comment.