Sep 23, 2012, 2:35 PM
Click a Menu:menuitem from a different panel
Hi All,
I am using a variant of the dashboard from the Ext.net MVC site. I need to click a accordian menuitem from
a dasboard dataview image as the image capture shows.
The 1.x funcitionality worked as javascript example below shows. The dataview javascript is shown below.
The node[0].getAttibutes method find the master page's accordion panel menu. it then fires an itemclick
event to the Menu Click handler. This instatiates the creation of a tab strip.
The DOM objects are correct. The Menu object fires the event but the click handler doesn't get it.
I am using a variant of the dashboard from the Ext.net MVC site. I need to click a accordian menuitem from
a dasboard dataview image as the image capture shows.
<ext:MenuPanel ID="ConfigurationMenuPanel" runat="server" Border="false" SaveSelection="false" Cls="white-menu">
<Menu ID="ConfigurationMenu" runat="server" AutoScroll="true" AutoHeight="true">
<Items>
<ext:MenuItem ID="BusinessModelListMenuItem" runat="server" Text="Business Models" Icon="Bricks" >
<CustomConfig>
<ext:ConfigItem Name="url" Value="/Configuration/BusinessModelList/" Mode="Value" />
</CustomConfig>
</ext:MenuItem >
<ext:MenuItem ID="BankAccountInstancesDefinitionMenuItem" runat="server" Text="Bank Account Instances" Icon="Money" >
<CustomConfig>
<ext:ConfigItem Name="url" Value="/Configuration/BankAccountInstances/" Mode="Value" />
</CustomConfig>
</ext:MenuItem >
</Items>
<Listeners>
<Click Handler="STSFinancialBrowser_addTab({ tabView: '#{tpMainPanel}', title: menuItem.text, url: menuItem.url, icon: menuItem.iconCls, passParentSize: menuItem.passParentSize});" />
</Listeners>
</Menu>
</ext:MenuPanel>
The 1.x funcitionality worked as javascript example below shows. The dataview javascript is shown below.
The node[0].getAttibutes method find the master page's accordion panel menu. it then fires an itemclick
event to the Menu Click handler. This instatiates the creation of a tab strip.
var selectionChanged = function(dv, nodes) {
if (nodes.length > 0) {
var panel = nodes[0].getAttribute('ext:panel');
var menu = nodes[0].getAttribute('ext:menu');
if (!Ext.isEmpty(panel, false)) {
parent.window[panel].expand();
}
if (!Ext.isEmpty(menu, false)) {
parent.window[menu].parentMenu.fireEvent("itemclick", parent.window[menu]);
}
}
}
var viewClick = function(dv, e) {
var group = e.getTarget('h2', 3, true);
if (group) {
group.up('div').toggleClass('collapsed');
}
}
The 2.x funcitionality dataview javascript is different as shown below.var itemClick = function (view, record, item, index, e) {
var group = e.getTarget("h2", 3, true);
if (group) {
group.up("div").toggleCls("collapsed");
return false;
}
var item = e.getTarget(".item-wrap");
if (item) {
var panel = item.getAttribute('ext:panel');
var menu = item.getAttribute('ext:menu');
if (!Ext.isEmpty(panel, false)) {
parent.window[panel].expand();
}
if (!Ext.isEmpty(menu, false)) {
parent.window[menu].parentMenu.fireEvent("click", parent.window[menu]);
}
}
}
What doesn't work is the parent.window[menu].parentMenu.fireEvent("click", parent.window[menu]);
code.The DOM objects are correct. The Menu object fires the event but the click handler doesn't get it.
Last edited by Daniil; Sep 24, 2012 at 7:27 AM.
Reason: Please use [CODE] tags