Serverside Datasource with Clientside Filtering and auto-refresh?

Serverside Datasource with Clientside Filtering and auto-refresh?

CholtzklotzCholtzklotz Posts: 3Questions: 1Answers: 0

Heya!

I've tried to make it work, but it seems it takes more than i thought..

The problem is simple: i have a serverside datasource which returns a json (made it datatables-conform already, so the data is correctly displayed on first draw).
now i don't want to query the server for filtering, as the filterable columns themselves don't change. i just want to filter for one column.

right now, the datatable requests the json (which obviously doesn't change, as i haven't implemented any serverside searching) again on every input.

i would like to filter the list that i got on the first draw, is that possible? if so, can you please hint me in a direction?

and THEN i'd like to auto-refresh the values in the second column on a given interval.

(basically it's a list of currencies. name - price. names never change, i want to be able to filter those, while also periodically updating the prices via ajax).

i hope you can understand my problem :)
best regards

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 21,083Questions: 26Answers: 4,908
    edited August 2018

    If you are using server side processing then the searching must take place server side since the client only contains the rows currently displayed. Sounds like you are trying to implement column based searching with either text inputs or drop down lists. If thats the case then maybe the YADCF plugin will help.

    Kevin

  • CholtzklotzCholtzklotz Posts: 3Questions: 1Answers: 0

    is there really no way to get the data from server, but filter it on the client? that's sad :(

  • kthorngrenkthorngren Posts: 21,083Questions: 26Answers: 4,908
    Answer ✓

    is there really no way to get the data from server, but filter it on the client? that's sad

    I think I misunderstood your first post. I thought you had Server Side Processing enabled. But it sounds like you just have "serverside" data.

    If you are using Datatables client side processing mode you can do the following:

    i would like to filter the list that i got on the first draw, is that possible?

    You can use search to set the initial table search.

    THEN i'd like to auto-refresh the values in the second column on a given interval.

    One option is to use ajax.reload() to reload the full table via ajax. To load data for just one column and have it update would be more work as you woould need to code the JS to loop through the retrieved data and update each row.

    Kevin

  • CholtzklotzCholtzklotz Posts: 3Questions: 1Answers: 0

    I think I misunderstood your first post. I thought you had Server Side Processing enabled. But it sounds like you just have "serverside" data.

    Wow... in fact, you understood my post better than i did :smiley:
    I actually didn't know it was possible to have a serverside datasource without specifying "serverside: true".
    So... i HAD serverside processing activated, thinking it would be required for serverside data sources.

    now i switched to serverside: false, and it does JUST what i want it to: get data from server, but filter it on client.
    thanks :D i would probably not have figured this one out by myself haha.

    will try to get the auto-refresh going now, thanks so far :)

This discussion has been closed.