Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

className should be table-active by default #2

Open
Seb33300 opened this issue Nov 7, 2024 · 3 comments
Open

className should be table-active by default #2

Seb33300 opened this issue Nov 7, 2024 · 3 comments

Comments

@Seb33300
Copy link

Seb33300 commented Nov 7, 2024

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

@AllanJard
Copy link
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.

@Seb33300
Copy link
Author

Seb33300 commented Nov 8, 2024

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.

@AllanJard
Copy link
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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants