After using Tabulator for a few years, we have decided to switch over to Angular v13 and upgrade to the new Tabulator 5.x. In our previous implementation, we had set up a custom ContextMenu in the Table Column Definition like this:
contextMenu: this.TableRowClicked.bind(this),
The function definition for TableRowClicked was as follows:
public TableRowClicked(data: any, e: Event): void {
We used the Tabulator contextMenu solely as a trigger to create our own customized Context Menu system which looked something like this:
However, with the new Tabulator 5.x, it appears that there have been changes regarding the contextMenu functionality. Now, it seems like we are required to return an array of menu items. I might be misunderstanding this, but it seems like we can no longer just use it as a trigger to call the creation of our own Context Menu. Can someone clarify if my understanding of the input and return types of the new context Menu function is correct?
In Tabulator 5, I have defined the function as:
public TableRowClicked(cell: Tabulator.MenuObject<Tabulator.CellComponent>, e: UIEvent): (Tabulator.MenuSeparator | Tabulator.MenuObject<Tabulator.CellComponent>)[] {
But now, when trying to define the contextMenu
in the Tabulator Column Definition, I receive the following error message:
Type '(cell: MenuObject<CellComponent>, e: UIEvent) => (MenuObject<CellComponent> | MenuSeparator)[]' is missing the following properties from type '(MenuObject<CellComponent> | MenuSeparator)[]': pop, push, concat, join, and 27 more.ts(2740)
index.d.ts(1412, 9): The expected type comes from property `contextMenu` which is declared here on type `ColumnDefinition`
I would greatly appreciate any assistance in understanding the new approach in Tabulator 5 or identifying what I might be doing wrong. This issue is currently hindering our transition from Tabulator 4.9.3 to Tabulator 5.
Thank you,
Michael