Alignment issue of checkbox in header
Alignment issue of checkbox in header

Link to test case:
https://datatables.net/extensions/select/examples/checkbox/checkbox.html
Description of problem:
Hello,
I am using the latest DataTables 2.3.2 with Bootstrap 4.6. (using Bootstrap style)
The first column of my table is the checkbox(using Select Extensions).
To select all of the rows, i clicked on the checkbox in the table header, but i found the aligment in the header has an issue. It's not align center or align middle.
How can i solve it ?
Thanks
Ben
Settings:
select: {
style: 'os',
selector: 'td:first-child'
},
const commonColumns = [
{
name: 'checkbox',
data: null,
title: '',
width: '3%',
className: 'text-center align-middle',
orderable: false,
searchable: false,
placeholder: 'Not for input'
},
...
]
const commonColumnDefs = [
{
targets: 'checkbox:name',
render: DataTable.render.select()
},
...
]
This question has accepted answers - jump to:
Answers
Odd that it is off to the left for you. Its going to the right a bit for me in the example you linked to. Is the screenshot from that page?
If you are seeing this on you own page, could you try:
And see if that helps?
Thanks,
Allan
Thanks Allen for the reply.
The screenshot is of my webpage, not the example.
I also saw that the checkbox in the example is a little bit to the right.
I tried adding CSS, but unfortunately, it didn't work.
This is the HTML code for the header checkbox of my page added by DataTables.
Thanks
Ben
Overall settings for the DataTables:
It seems that the following CSS works for me.
I think that when I add the bootstrap class "table-sm" to the table. it would align more to the right.
I didn't have this problem with DataTable 2.2.2 and Select 3.0.0.
I would roll back to the older version until this problem has been fixed.
https://cdn.datatables.net/v/bs4/moment-2.29.4/dt-2.2.2/b-3.2.2/sc-2.4.3/sl-3.0.0/datatables.min.js
Can you link to a page showing the issue with it aligning to the left please? I haven't been able to reproduce that.
Allan
Hello Allen,
I have created a test case in this link.
https://live.datatables.net/jexevinu/3/
Thanks
Ben
Hi Ben,
Many thanks! Yup, I can see it there as well. I'll take a look into it and post back with a fix - good chance that will be Monday.
Allan
Thanks again for the test case. I've committed a change to address the issue.
Here is the test case updated with the Select nightly.
I'll do a release of Select in the near future to address this.
Allan
Hi Allen,
Thanks so much for this.
I can see this issue has been fixed in the test case with Select nightly.
Thanks
Ben
I also faced similar issue but now I got the solutions.
Thanks everyone for the support.
Hi Allen,
Just want to check if above change has been released to stable version?
Hi,
It hadn't been, but it is now. Select 3.1.0 now released with this change
.
Allan
Hi Allan,
Thank you so much.
Ben