Would it not be better to show a separate list of columns in a menu below your button? Or you want to trigger the column menu as in your screenshot?
Re: [ANGULAR] Add Toolbar button for ColumnPicker
Posted: Thu Jan 06, 2022 3:40 pm
by bherford
Hi Mats,
I'd like my dropdown button in the toolbar to open a list of columns, with checkboxes to hide/show the columns in the grid - Essentially a copy of the columnpicker that you can open by right clicking the column header.
Hi Alex, this was very helpful but I am struggling with implementation.
I have a function in my GanttToolbar.js:
onColumnLoad({ menu }) {
// Build list of column names
const menuList = [];
// Test
// console.log(this.gantt.subGrids.locked.columns.data.text)
this.gantt.subGrids.locked.columns.forEach( i => {
menu.add(
{
text: i.data.text
}
)
});
// Add list to menu - BREAKS
// menu.add(menuList)
// To eventually set hidden property
//bryntum.query('gantt').subGrids.locked.columns._data[1].data.hidden
//this.gantt.subGrids.locked.columns.getById(item.id).hidden = !checked;
}
With a listener on the button:
{
type : 'button',
ref : 'columnButton',
icon : 'b-fa b-fa-columns',
cls : 'edge-toolbar-btn columnBtn',
text : 'Columns',
tooltip : 'Hide Columns',
onToggle : 'up.onColumnLoad', // Defined on line:194
menu : {
// Populate on paint
items : [
{test : "dummy",
checked : true}
]
}
},
You can find the result in the .mov below.
I want the column list to load when you click the button. But I can't seem to get the list to load without putting a checkbox item in the menu.