Grid header menu vs context menu items

  • I have a grid header toolbar with items which duplicate a context menu on the grid row.
    It looks like they're different beasts though. I was hoping I could create an array of items and reuse them in both the toolbar and context menu. Is there another way to do this, am I approaching it the wrong way, or do I just need to replicate the commands?

    E.g. In the snippet below, I'd like to reuse the items in this.rowMenu and this.headerTB.


    function RisksetGrid() {
    this.reader = new Ext.data.XmlReader({
    record: 'sosn_item',
    totalRecords: 'totalrecords',
    id: 'name'
    }, [
    'name', 'slot', 'docs', 'clusters', 'maxcluster', 'group', 'location', 'updated'
    ]);
    this.cm = new Ext.grid.ColumnModel([
    {header: "Asset Name", id: 'expand', align: 'left', width: 150, dataIndex: 'name', tooltip: "A tooltip for the Asset Name"},
    {header: "Slot", hidden: true, width: 30, dataIndex: 'slot', tooltip: BLANK_TOOLTIP},
    {header: "Documents", width: 70, dataIndex: 'docs', tooltip: BLANK_TOOLTIP},
    {header: "Max Cluster", hidden: true, width: 70, dataIndex: 'maxcluster', tooltip: BLANK_TOOLTIP},
    {header: "Clusters", width: 50, dataIndex: 'clusters', tooltip: BLANK_TOOLTIP}
    ]);
    this.rowMenu = new Ext.menu.Menu({
    id: 'rowMenu',
    items: [
    { text: 'View Documents', icon: 'ui/icons/folder.png', handler: loadRisksetDocs},
    { text: 'Refresh', icon: 'ui/icons/arrow_refresh.png', handler: loadAssets}
    ] });
    // Invoke superclass constructor
    RisksetGrid.prototype.superclass = Grid;
    Grid.call(this, PAGE_RISK, false);
    // Store any constructor variables
    this.title = '

    Content Profiles

    Risk Sets

    ';
    this.titleMask = '

    Content Profiles ({0} documents)

    ';
    this.url = '../cgi-bin/au1admin.exe?cmd=xrisksets';
    this.displayMsg = 'Displaying content profiles {0} - {1} of {2}';
    this.emptyMsg = "No profiles to display";
    }
    // Create prototype object
    RisksetGrid.prototype = new Grid();
    RisksetGrid.prototype.constructor = RisksetGrid;
    // Add instance methods...
    RisksetGrid.prototype.createHeaderTB = function() {
    this.headerTB = new Ext.Toolbar ( this.header,
    [
    { cls:'x-btn-text-icon',
    icon: 'ui/icons/folder.png',
    tooltip: "View Documents",
    text: "View Documents",
    handler: loadRisksetDocs
    },
    '-',
    { cls:'x-btn-text-icon',
    icon: 'ui/icons/arrow_refresh.png',
    tooltip: "Refresh",
    text: "Refresh",
    handler: loadRisksets
    }
    ]
    );
    }
    // Event handlers

    Thanks,
    Gerry


  • In 1.x they are incompatible as they each have different configs available and different ways of setting icons. In 2.0, they are generally compatible as long as you use iconCls.







  • #If you have any other info about this subject , Please add it free.#
    Your name:
    E-mail:
    Telphone:

    Your comments:


    If you have any other info about Grid header menu vs context menu items , Please add it free.