select_all table tools doesn't obey filter selector

select_all table tools doesn't obey filter selector

dp@ii.netdp@ii.net Posts: 38Questions: 10Answers: 0

This may not be a bug, more a feature, but it would be nice if the select_all tabletools button would object the oSelectorOpts filter:applied like "copy to clipboard" and "xls".

I have

            {
                "sExtends": "select_all", "sButtonText": "Select All", "oSelectorOpts": { "filter": 'applied' }
            },

and

            { "sExtends": "copy", "sButtonText": "Copy to clipboard", "oSelectorOpts": { "filter": "applied" } },

I filter down to some number of rows using the inbuilt search. If I select all and then perform a custom button action and use fnGetSelectedData() to look for rows that were selected I find the whole database and not just the rows that were matching the filter.

If select_all would obey oSelectorOpts then that would make select all a heap more useful.

thanks.

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,494Questions: 1Answers: 10,470 Site admin
    Answer ✓

    Hi,

    Good point! As a work around, what you could do us use the rows().nodes() method which do provide control over the rows being selected, and then feed the result into fnSelect:

    tableTools.fnSelect(
      table.rows( { "filter": "applied" } ).nodes().toArray()
    );
    

    TableTools is going to be replaced with a more "modern" library in the next few months, so I'm only really fixing bugs in it at the moment rather than introducing new features. The new library will be better equipped for this kind of thing and for the new DataTables API.

    Regards,
    Allan

  • dp@ii.netdp@ii.net Posts: 38Questions: 10Answers: 0

    thanks.

  • stavstav Posts: 3Questions: 1Answers: 1

    Perhaps another work-around would be fnSelectAll(true)

    https://www.datatables.net/extensions/tabletools/api#fnSelectAll

  • allanallan Posts: 63,494Questions: 1Answers: 10,470 Site admin

    I'd forgotten about that one! Yes, that would work as well.

    Allan

This discussion has been closed.