Dynamic load filtering doesnot work with custom request call to server

edited January 2018 in Technical questions

I have a datatable that loads in data dynamically.In the "ondatarequest" event i have my own ajax call (POST) that gets back data from the server and returns to the grid. When i try to filter the data it would return back the correct data but the datatable doesnot update the height and scrollbar according the new total_count.

I am passing in the start,count,filter,continue properties to the server. And my data has the following properties: data,pos,total_count.

And i update the filtered data through this code:

datatble.parse(filtereddata, "json");

On debugging i could find that the order(datatble.data.order) doesnot get updated correctly.

Can you please guide me in fixing the issue?
This is my datarequest event

messageResultsGrid.attachEvent("onDataRequest", function(start, count, callback, url){

filtereddata= getDataFromServer()//gets back data through ajax call
datatble.parse(filtereddata, "json");

});

Comments

  • On data reloading, datatable has to be cleared before loading (parsing) the new dataset:

    datatble.clearAll();
    datatble.parse(filtereddata, "json");
    

    Otherwise, existing data will not be updated properly.

    Also, please note that it makes sense to use the callback of async AJAX request to perform these operations.
    In case of webix.ajax, you can also use the promise API.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion