Nov 21, 2016, 5:02 AM
Add Custom Menu Item to a GridFilter (ListFilter)
Hi,
I've got a custom menu in my code which contains menu check items. There is also another item which acts as a Select All button. This all works great.
Now, I want to add this same Select All functionality to a remote ListFilter I've got (i.e being able to click a button to check every filter in the list), and I can't figure out how to add a custom menu item.
Here is the code for the original custom menu where I add the select all button:
Any help is appreciated.
I've got a custom menu in my code which contains menu check items. There is also another item which acts as a Select All button. This all works great.
Now, I want to add this same Select All functionality to a remote ListFilter I've got (i.e being able to click a button to check every filter in the list), and I can't figure out how to add a custom menu item.
Here is the code for the original custom menu where I add the select all button:
menu.add({
xtype: 'menucheckitem',
text: this.selectAllText,
checked: !(this.checkIndexes instanceof Array),
hideOnClick: false,
handler: function (item) {
var checked = item.checked;
item.parentMenu.items.each(function (i) {
if (item !== i && i.setChecked && !i.disabled) {
i.setChecked(checked);
}
});
}
}, '-');
And here is what I've tried:assetClassFilter.MenuConfig = new Menu
{
Items =
{
new CheckMenuItem
{
Text = "Select All",
Checked = true,
HideOnClick = false,
Handler = @"var checked = item.checked;
item.parentMenu.items.each(function (i) {
if (item !== i && i.setChecked && !i.disabled) {
i.setChecked(checked);
}
});"
}
}
};
I've also tried adding the item to the MenuItems property, which also doesn't work.Any help is appreciated.