PDA

View Full Version : Ext.Action && Ext.Toolbar && Ext.menu.Menu



Ex_Soft
30 May 2012, 11:02 PM
I want to use Ext.Action in Ext.Toolbar and Ext.menu.Menu at one time. But I want that Ext.Action in Ext.Toolbar will be with only icon and in Ext.menu.Menu will be with icon and text. Is it possible to make this? For example:


Ext.onReady(function() {
Ext.QuickTips.init();

var
actions = [];

actions["action1"] = new Ext.Action({
text: "TestAction1",
iconCls: "iconTools",
handler: doAction
});

actions["action2"] = new Ext.Action({
text: "TestAction2",
handler: doAction
});

Ext.create("Ext.toolbar.Toolbar", {
items: [
actions["action1"],
{
text: "Menu# 1",
menu: [
actions["action1"],
actions["action2"]
]
}],
renderTo: Ext.getBody()
});
});

function doAction(menuItem, e) {
if(window.console && console.log)
console.log("doAction(%o)", arguments);
}

Button in Ext.Toolbar has icon and text.

Ex_Soft
1 Jun 2012, 1:06 AM
...
Ext.define("ButtonWOText",{
extend: "Ext.button.Button",

initComponent: function() {
this.callParent(arguments);
this.setTooltip(this.getText());
this.setText("");
}
});
...
Ext.create("Ext.toolbar.Toolbar", {
...
items: [new ButtonWOText(smthAction)],
...
});