Ext.grid.header.Container-addMoreMenu.js (1675B)
1 Ext.define("PartKeepr.ExtJS.Enhancements.addMoreMenu", { 2 override: "Ext.grid.header.Container", 3 4 /** 5 * Returns an array of menu CheckItems corresponding to all immediate children 6 * of the passed Container which have been configured as hideable. 7 */ 8 getColumnMenu: function (headerContainer) 9 { 10 var menuItems = [], 11 i = 0, 12 item, 13 items = headerContainer.query('>gridcolumn[hideable]'), 14 itemsLn = items.length, 15 menuItem; 16 17 for (; i < itemsLn; i++) 18 { 19 item = items[i]; 20 menuItem = new Ext.menu.CheckItem({ 21 text: item.menuText || item.text, 22 checked: !item.hidden, 23 hideOnClick: false, 24 headerId: item.id, 25 menu: item.isGroupHeader ? this.getColumnMenu(item) : undefined, 26 checkHandler: this.onColumnCheckChange, 27 scope: this 28 }); 29 menuItems.push(menuItem); 30 } 31 32 menuItems.push('-'); 33 34 menuItems.push(Ext.menu.CheckItem({ 35 text: i18n("Customize…"), 36 iconCls: 'fugue-icon table--pencil', 37 menu: item.isGroupHeader ? this.getColumnMenu(item) : undefined, 38 handler: this.foo, 39 scope: this 40 })); 41 42 // Prevent creating a submenu if we have no items 43 return menuItems.length ? menuItems : null; 44 }, 45 foo: function () { 46 var j = Ext.create("PartKeepr.Components.Widgets.ColumnConfigurator.Window", { 47 grid: this.grid 48 }); 49 j.applyColumnConfigurationFromGrid(); 50 j.show(); 51 } 52 });