Ext.NET icon indicating copy to clipboard operation
Ext.NET copied to clipboard

ext-menu gets force-rendered and constrained to a div

Open fabriciomurta opened this issue 5 years ago • 0 comments

Found: 7.1.0 Ext.NET forum thread: EXT.NET 7 Grid Panel Context Menu

When an ext-menu is defined at top level of the page, it receives a dedicated div and a renderTo constraining it to that div instead of the whole page (Ext.getBody()). It would probably be good not to force any renderTo at all in that case, so it is only rendered the first time it is shown.

To reproduce the issue, given the GridPanel > Array Grid > Simple example, add a menu like this:

<ext-menu id="gridMenu">
    <items>
        <ext-menuItem text="Edit" iconCls="x-fa fa-edit">
            <listeners>
                <click handler="App.Window1.show()" />
            </listeners>
        </ext-menuItem>
        <ext-menuItem text="Delete" iconCls="x-fa fa-delete">
            <listeners>
                <click handler="App.Window1.show()" />
            </listeners>
        </ext-menuItem>
    </items>
</ext-menu>

Then this listener to the grid panel:

<listeners>
    <rowContextMenu handler=" e.preventDefault(); App.gridMenu.dataRecord = this.store.getAt(rowIndex); App.gridMenu.showAt(e.getXY());" />
</listeners>

To work around the issue, on option is to give the page's body an ID, like:

<body id="PageBody">

Then add renderTo="PageBody" to the ext-menu definition.

fabriciomurta avatar Nov 04 '20 19:11 fabriciomurta