dynamically set the header menu data in webix?

788 Views Asked by At

dynamically set the header menudata like columns below

headermenu: { id: "headerMenu", css: "webix-contextmenu", width: 150, data: getHeaderMenuData(),

}

Like setting externally for columns, function add_column(){ var columns = webix.toArray(grid.config.columns); columns.insertAt({ id:"c"+webix.uid(), header:"New column" },2); grid.refreshColumns(); }

is there a way that I can set for headerMenu data.

1

There are 1 best solutions below

0
On BEST ANSWER

Normally the header menu will regenerated self after refreshColumns call, and will include the newly added column. ( you may need to update to the latest version of Webix )

Also, you can add items to header menu directly, by using code like next

var menu_id = grid.config.headermenu;
$$(menu_id).add({
  id:"new", value:"NEW"
});