Display Selection Info When Style is 'api'

Display Selection Info When Style is 'api'

jehugaleahsajehugaleahsa Posts: 11Questions: 3Answers: 0

I noticed when I switched the select.style to 'api' that the selection information disappeared. Setting it back to 'os', etc. causes it to return. I need to programmatically select/deselect rows (via a checkbox) and still want to see the info. Is this possible? Do I need to do something additional when controlling selection manually?

I also noticed that table.select.info() returns an API object rather than true or false (a boolean). This seems like bug and I am not sure if it is related.

This question has an accepted answers - jump to answer

Answers

  • colincolin Posts: 15,143Questions: 1Answers: 2,586

    When you switch between styles, I would expect the selected rows to be deselected, as the new style may not allow the selections made under the previous style. You could add some logic in your code, find out what was selected, and made a decision on whether to re-select.

    And yep, there's an outstanding bug for select.info() (DD-859 for my reference) - I've made a note to update this thread when the issue is progressed.

    Colin

  • jehugaleahsajehugaleahsa Posts: 11Questions: 3Answers: 0

    @colin I am not switching between 'os' and 'api' dynamically. I am just going 100% 'api' and not seeing the selection info appearing. I was curious if this is the expected behavior. Do I need to display the selected count manually when I use 'api'?

    Thanks for confirming the bug with info. Appreciated.

  • colincolin Posts: 15,143Questions: 1Answers: 2,586
    Answer ✓

    Ah, I see. That's intentional. The justification is that if the user isn't able to select, they probably don't care how many rows are selected by the API. And if the programmer thinks that's useful info, we assumed they'd create their own info element.

    You can change it in locally, here's the code here, or create your own info area as an alternative.

    Colin

  • jehugaleahsajehugaleahsa Posts: 11Questions: 3Answers: 0

    Thank you, @colin. I am going to go to the documentation for style and add a comment there. Deeply appreciated!

  • allanallan Posts: 61,716Questions: 1Answers: 10,108 Site admin

    Long delay on this one - sorry. It has been fixed now and will be in the nightly shortly.

    Regards,
    Allan

This discussion has been closed.