SearchPane: Showing panes dynamically [Bug]

SearchPane: Showing panes dynamically [Bug]

SagnalracSagnalrac Posts: 3Questions: 1Answers: 0

I think i found a bug in the SearchPane extension configuration, specifically with the targets option.

I have this example where every column has a checkbox. and there is a link with "Create Filter" text. If the user selects one or more checkboxes and then clicks the link, the SearchPane section will be visible but only with the selected columns, otherwise the SearchPane section wil hide.

With dummy data is working fine. Here's the jsFiddle

But if I use data similar to the data used in the examples on this site, it starts behaving oddly.

Here's a working example

As you can see, if I only check one checkbox, the SearchPane shows two columns:

Even if I hardcode the targets option to show only the first coiumn, the SearchPane shows three columns:

Is this a bug, or maybe I'm doing something wrong?

This question has an accepted answers - jump to answer

Answers

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

    Hi @Sagnalrac ,

    I suspect that what you need to do is set the columns that have not been selected to have the columns.searchPanes.show property set to false. This will then force them to hide. Take a look at this example.

    Thanks,
    Sandy

  • SagnalracSagnalrac Posts: 3Questions: 1Answers: 0

    Thank you very much @sandy !

    Your solution was awesome!

    So, I guess for this kind of scenarios I need to handle both, columns I'd like to show and columns I need to hide, is that correct?

    Oh, and one more question, will your solution still works if I have my data right in the HTML table instead of getting through a JSON array or Ajax request, but that some of the cells have extra HTML elements? For example:

    <td id="code_1" class="col-2">
       <span class="float-left">
          <em class="fa fa-eye pointer fa-visible" data-title="Visible"></em>
          <em class="fa fa-check pointer fa-active" data-title="Active"></em>
       </span>
        1212
    </td>
    

    Because in that kind of scenarios this is what it's being showed in the SearchPane:

  • sandysandy Posts: 913Questions: 0Answers: 236

    Hi @Sagnalrac ,

    Yes you will need to look at both. The idea behind columns.searchPanes.show is not to limit the columns that SearchPanes will process and decide are to be shown based on the searchPanes.threshold. Instead columns.searchPanes.show is there to force certain columns to either hide or show a Pane.

    We've actually picked up on the html issue already. There is a fix in the nightly builds, I would suggest that you get the SearchPanes code from there until the next release (which should be soon).

    Thanks,
    Sandy

  • SagnalracSagnalrac Posts: 3Questions: 1Answers: 0

    Awesome! Than you very much again @sandy !

This discussion has been closed.