Skip to content

className should be table-active by default #2

Open

Description

@Seb33300

The default className for Bootstrap 5 tables should be table-active instead of selected as in the Bootstrap 5 documentation:
https://getbootstrap.com/docs/5.3/content/tables/#active-tables

Activity

  1. AllanJard commented on Nov 7, 2024

    @AllanJard
    Contributor

    Do you mean the class on the <tr>, not the <table>?

    There isn't actually an option to change that in Select at the moment, but I can add that. I think the Bootstrap table-active class is a bit too subtle for the intention of Select, but I can certainly look at adding that option.

  2. Seb33300 commented on Nov 8, 2024

    @Seb33300
    Author

    Hi @AllanJard,

    I mean the class name on the <tr> (which is .selected by default).
    Or on the <td> if the select extension is configured to select cells instead of rows.

    If you look at my previous link on Bootstrap documentation, the class .table-active is used on <tr> or <td> to highlight them.
    So i think this is a better replacement to be used instead of the .selected class when working with Bootstrap 5.

    You already provide an option to change that class: https://datatables.net/reference/option/select.className

    I tried to override the default value but it did not work:

    $.extend(true, DataTable.defaults, {
        select: {
            className: 'table-active'
        }
    );

    I also tried:

    $.extend(true, DataTable.defaults.ext.select, {
        className: 'table-active'
    );

    Not sure what I am doing wrong.

    Note: if I use that option directly when creating a datatable, it works.
    But I would like to set it as the default value.

  3. AllanJard commented on Nov 8, 2024

    @AllanJard
    Contributor

    I don't think you are doing anything wrong, it just does support setting a default yet. That is an oversight on my part and something that I need to address.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions