Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion types/tabulator-tables/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1432,7 +1432,7 @@ export interface ColumnDefinition extends ColumnLayout, CellCallbacks {
/** You can add a menu to any column by passing an array of menu items to the headerMenu option in that columns definition. */
headerMenu?:
| Array<MenuObject<ColumnComponent> | MenuSeparator>
| (() => Array<MenuObject<ColumnComponent> | MenuSeparator>)
| ((e: MouseEvent, component: ColumnComponent) => Array<MenuObject<ColumnComponent> | MenuSeparator>)
| undefined;

/** The headerMenuIcon option will accept one of three types of value. You can pass in a string for the HTML contents of the button. Or you can pass the DOM node for the button. Though be careful not to pass the same node to multiple columns or you may run into issues. Or you can define a function that is called when the column header is rendered that should return either an HTML string or the contents of the element. This function is passed the column component as its first argument. */
Expand Down
13 changes: 13 additions & 0 deletions types/tabulator-tables/tabulator-tables-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1781,3 +1781,16 @@ table = new Tabulator("#test-selectableRowsCheck", {
table.selectRow([1, 2, 3]);
const selectedRows = table.getSelectedRows();
console.log("Number of selected rows:", selectedRows.length); // Should be 2 (only rows with age >= 18)

const headerMenuFunc = function(_e: MouseEvent, component: ColumnComponent) {
return [{
label: "Test",
}];
};

table = new Tabulator("#test-selectableRowsCheck", {
columns: [
{ title: "ID", field: "id" },
{ title: "Name", field: "name", headerMenu: headerMenuFunc },
],
});