Searchpanes and Colvis controls aross two tables that share row and column headers

Searchpanes and Colvis controls aross two tables that share row and column headers

Mockingbird26Mockingbird26 Posts: 6Questions: 2Answers: 0
edited July 2020 in Free community support

I have two tables that share the same column headers and the same row headers. The only thing that differs is the values inside the cells. (They are smaller for the second table). Otherwise these tables are identical. So they take in two different datasets.

I am using searchpanes button and colvis button to filter on the first table. I want any filtering on the first table to also happen to the second table. How can I accomplish this?

It doesn't seem like any others have posed this question. I know you can use 'table' to instantiate two tables as once. However, that seems to take only the first table's data into account (data:), and searchpanes and colvis don't occur cause changes to happen to the second table.

I have also tried to add the searchpanes and colvis buttons to the advanced init defaults, to no avail.

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,213Questions: 1Answers: 10,415 Site admin

    Iā€™m afraid there currently no way to do what you are looking for.

    Allan

  • Mockingbird26Mockingbird26 Posts: 6Questions: 2Answers: 0

    As an alternate approach, is it possible to get the selected rows and selected cols from the first table, and feed them into the second?

  • allanallan Posts: 63,213Questions: 1Answers: 10,415 Site admin

    Yes, you could use the rows() method with the selected rows modifier (e.g. table.rows({selected:true})...) to get the selected rows. You can also use columns() with a suitable modifier (e.g. visible columns) to find out what columns are visible, or hidden.

    With that information you could then apply that to the second table (assuming its structure is identical).

    Allan

  • Mockingbird26Mockingbird26 Posts: 6Questions: 2Answers: 0
    edited August 2020

    This is how I have it set up:
    var table = ....
    var rows_table = table.rows({selected:true});
    var mtable = ...
    mtable.row( rows_table ).select();

    Is this what you mean? Currently, it's not working. We are using searchpanes to filter.

  • allanallan Posts: 63,213Questions: 1Answers: 10,415 Site admin
    Answer āœ“

    No, because rows_table is a reference to the host table. Do you have an id for the rows? If so you could use rows().ids() to get the ids for the host table and then use that as a selector.

    Apologies, I see the confusion, the ... in my post before was meant to indicate that you need to get the data or something to identify the rows, so you can then pick them out in the second table and select them.

    I suspect you've bitten off a fairly large challenge to get the two syncing up here!

    Allan

  • Mockingbird26Mockingbird26 Posts: 6Questions: 2Answers: 0

    Thank you, Allan! A big bite indeed. I haven't gotten it yet, but I'm understanding more of it, and will keep fiddling till it works out right.

This discussion has been closed.