Get currently applied filters on SearchPanes

Get currently applied filters on SearchPanes

hrasthrast Posts: 17Questions: 5Answers: 0

Hello guys,

I'm currently using SearchPanes in production and it is awesome! Great job, really!

I just have one question. Is there any way possible to get list of currently applied filters on SearchPanes?
I am rendering a graph from filtered table values so it would help me a lot.

Thanks in advance!

This question has accepted answers - jump to:

Answers

  • sandysandy Posts: 913Questions: 0Answers: 236
    Answer ✓

    Hi @hrast ,

    Glad you are finding it useful!

    The SearchPanes themselves are DataTables so you can iterate over them like this and extract the rows as in the example.

    Hope this helps,
    Sandy

  • hrasthrast Posts: 17Questions: 5Answers: 0

    Thank you @sandy, that solves my problem! Many thanks!

  • hrasthrast Posts: 17Questions: 5Answers: 0

    Hey @sandy,

    How can I get list of active filters if searchPanes are opened by button?
    Example: live.datatables.net/baxinelu/7/edit

    Thanks in advance!

  • sandysandy Posts: 913Questions: 0Answers: 236
    Answer ✓

    Hi @hrast ,

    Something like this will do the trick. If you are using multiple buttons then you will need to add a class or an id to the SearchPanes button to only click that one.

    Hope this helps,
    Sandy

  • tableguy101tableguy101 Posts: 2Questions: 0Answers: 0
    edited February 2021

    Hey @sandy,

    I was trying to adjust your code so that it console logs the filter values whenever you click on a field in the search panes. I kind of got it working but every time I click it shows me the previous state, missing the current value that I clicked.

    this is what I added

          $('.dtsp-name').on('click', function () {
                $('.dtsp-searchPane table:visible').each(function (t) {
                    console.log($(this).DataTable().rows({ selected: true }).data().toArray())
                })
            });
    

    all the values within the search panes have a class name of dtsp-name.

  • tableguy101tableguy101 Posts: 2Questions: 0Answers: 0

    Hello, Thank you for this awesome software. I was actually trying to implement something similar to this question and couldn't get it to to work.
    How can I get the filtered search pane results as I click on values within the panes. Rather than what was clicked, I want to get the results as I click on the options within the search panes.

  • colincolin Posts: 15,237Questions: 1Answers: 2,599

    @tableguy101 We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Cheers,

    Colin

This discussion has been closed.