Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

414
Views
Tabulator: titleFormatter: "rowSelection" when clicking header select all checkbox

When I click on the checkbox to select/deselect all rows in my table the headerClick function doesn't fire (It will fire for everything in the header but the checkbox). This is my column set up for it and I'm just wondering if this is a bug or if there is another way for me to trigger my function of getting all selected rows when I click the select all checkbox. Thanks!

columns: [
    {
        formatter: "rowSelection",
        titleFormatter: "rowSelection",
        hozAlign: "center",
        headerSort: false,
        visible: true,
        width: 40,
        headerClick: (e, column) => {
            console.log(e);
            let table = column.getTable();
            this.selectedRows = table.getSelectedRows();
            this.rowCount = this.selectedRows.length;
        }
    },
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

wouldn't say its a "bug", but it looks like you have a feature request, definitely. The code for `rowSelection has :

checkbox.addEventListener("click", function (e) {
    e.stopPropagation();
});

so on it's click, it's not letting anyone else know about it with stopPropagation(). And I don't see any code to getHeaderCheckbox() so that you might add your own clickHandler.

So I would go to to GitHub and lodge a feature request to be able to add your own handlers to this item. Unless he's already done it in 5.0 ? I haven't looked at it yet...

in the meantime, you could do your own version of this and not use the rowSelection formatter, or you could do a WHOLE lot of work to with getChildElements() to get a handle on the actual DOM element and insert your own handler (that would be LAST resort IMHO)

If you ABSOLUTELY must have it NOW (and I would absolutely NOT advise you doing this !!!) :

Give your column a field (say "selector" for example) for easy access and after your "new Tabulator()" ...

table.getColumn("selector")._column.titleElement.firstChild.addEventListener("click", function (e) {
   console.log(e);
   e.stopPropagation();
});

I did not say this, I was never here ....

about 4 years ago · Juan Pablo Isaza Report

0

The issue is you are trying to add functionality that isnt needed. The rowSelection formatter when used in the titleFormatter option will automatically handle the select/deselect all functionality, there is no need to listen to any click events yourself. it will do it all for you.

By adding the additional headerClick handler you are immediately negating the selection, by toggling things a second time

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!