Column filters refresh

Column filters refresh

tposzytektposzytek Posts: 5Questions: 1Answers: 0

Hi all!

I'm trying to solve this issue by my own but still getting stuck. Moreover I haven't find any working solution so far over the internet.
So, I have the following problem:
1. I'm using defer rendering for data,
2. I'm having filters in each column, some of which are plain-text filters, some of which are select filtres.

I'd like lists of possible options for select filters to be dynamically reduced when applying other filters, ex. if I input something in the text filter what would filter the data, I'd like options in <select> to adapt to the available values.

So far each found solution for drop-down filtering is always showing a full list of options, easily leading to a situation, where made choices are giving "Nothing to display", what is not UX good :)

I appreciate any help :)

Best regards,
Tomasz

This question has accepted answers - jump to:

Answers

  • daniel_rdaniel_r Posts: 460Questions: 4Answers: 67
    Answer ✓

    Take a look at my yadcf plugin showcase, go over the showcase and notice the cumulative_filtering: true option see Cumulative filtering example

  • tposzytektposzytek Posts: 5Questions: 1Answers: 0

    Hi Daniel!

    That indeed might be something I'm looking for. Just please tell me - will it work with defer rednering of a table? I mean - will it show all possible options for filters event if they are not physically loaded into DOM model?

    Regards,
    Tomasz

  • daniel_rdaniel_r Posts: 460Questions: 4Answers: 67
    Answer ✓

    Yes, you can read all the features of yadcf on showcase/github repo

    a glimpse from there:

    Notable datatables API / Features support
    ColReorder / scrollX / scrollY / stateSave / deferRender / HTML5 data-
    attributes / Complex headers*

  • tposzytektposzytek Posts: 5Questions: 1Answers: 0

    But, in the end, there is no built-in functionality? I mean a native working functionality that is already present in DataTables. Your plug-in which is really impressive is the only solution for such "complex" requirements?

  • daniel_rdaniel_r Posts: 460Questions: 4Answers: 67

    My plugin uses native datatables api under the hood. For what can DT provide I guess @allan is the addres :)

  • allanallan Posts: 61,446Questions: 1Answers: 10,054 Site admin

    This isn't something that DataTables core provides - it just gives the API methods to be able to get the data and trigger filtering. But it is a fairly easy modification to the filtering example to have the select entires update on-the-fly - just rebuild them on each draw. Here is a simple modification of the default example: http://live.datatables.net/gejojiqu/1/edit .

    Allan

  • tposzytektposzytek Posts: 5Questions: 1Answers: 0

    Hi Allan!

    yes, I managed to create the same solution you provided, but that is not the thing I wanted. In this solution I can only filter deeper. I am not able to support a situation, when for ex. in a text field I enter a value, that leaves two values for the select filter. Now in your and mine solution, when I then choose a value in a select filter, after draw I see only one option in select filter, but I expect to still see two, so that I would be able to switch to another set of options left by the text filter in the first place. I then must to click on an empty option in a select filter, to make a "step up".

    Do you understand what I mean? I was trying to code (and has not succeed :)) but the plug-in proposed by daniel seems to response to my needs.

  • allanallan Posts: 61,446Questions: 1Answers: 10,054 Site admin

    I do understand - thanks for the clarification. Either you'd need to modify the code to suit your needs, or use a plug-in such as Daniel's excellent YADCF.

    Allan

This discussion has been closed.