Abort previous ajax request before do a new one using Tabulator?

23 Views Asked by At

sorry, first time using Tabulator library, i am trying to use a search input, but i need to abort a previous request on insert a new letter in the search input, the idea is something like this, can anybody help me?

const completed_table = new Tabulator("#completed-log-table", {
        pagination: true,
        paginationMode:"remote",
        sortMode:"remote",
        ajaxURL: "/rostering-log-data",
        paginationCounter:"rows",
        layout: "fitColumns",
        placeholder: "No Data Set",
        columns: columns,
        movableColumns:true,
        resizableColumnFit: true,
        paginationSize: 10,
        paginationSizeSelector: [10, 50, 100, 500, 1000],
        ajaxURLGenerator:function(url, config, params){
            params.version = 'completed';
            params.search = $("#completed-log-table-search").val();
            return url + "?params=" + encodeURI(JSON.stringify(params));
        }
    });
    $( function() {
        $("#completed-log-table-search").on("input", function() {
            processing_table.settings.jqXHR.abort();
            completed_table.setData();
        });
    } );
0

There are 0 best solutions below