PDA

View Full Version : multiple button pointing to the same action



ljung
17 Jul 2009, 7:16 AM
Good morning,
I am new to ExtJs and I am having an issue porting some code to ExtJS 3.0.
I have an example that creates 2 buttons pointing to the same action. When using 2.2.1, 2 buttons are displayed on the page but only one is when I use 3.0.0.

Can somebody help me

Below is the example code that does not work with 3.0.0

Thanks

Laurent

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1"><title>
</title></head>
<body>
<link href='/Extjs_resx_3_0_0/css/ext-all.css' rel='stylesheet' type='text/css' />
<link href='/Extjs_resx_3_0_0/css/ext-Company.css' rel='stylesheet' type='text/css' />
<script src='/Extjs_resx_3_0_0/scripts/ext-base.js' type='text/javascript'></script>
<script src='/Extjs_resx_3_0_0/scripts/ext-all-debug.js' type='text/javascript'></script>
<script src='/Extjs_resx_3_0_0/scripts/ext-db.js' type='text/javascript'></script>
<script src='/Extjs_resx_3_0_0/scripts/gears.js' type='text/javascript'></script>
<script src='/Extjs_resx_3_0_0/scripts/ext-gears-db.js' type='text/javascript'></script>
<script src='/Extjs_resx_3_0_0/scripts/ext-util.js' type='text/javascript'></script>
<script src='/Extjs_resx_3_0_0/scripts/commonUtils.js' type='text/javascript'></script>
<script src='/Extjs_resx_3_0_0/scripts/ext-plugins-debug.js' type='text/javascript'></script>
<script src='/Extjs_resx_3_0_0/scripts/navigationPanel.js' type='text/javascript'></script>
<script src='/Extjs_resx_3_0_0/scripts/tracing/ExtJsControls-Trace-Level-1.js' type='text/javascript'></script>

<div id="panel1Div" style="height:400px;"></div>
<script type='text/javascript'>
var action1 = null;
var panel1 = null;
Ext.onReady(function(){
Ext.BLANK_IMAGE_URL = '/Extjs_resx_3_0_0/images/default/s.gif';
action1 = new Ext.Action(
{
text:'Action1- show message',
handler:function(){Ext.Msg.alert('action1', 'action1 invoked');},
actionId:'action1'
})
panel1 = new Ext.Panel(
{
title:'test actions',
id:'panel1',
applyTo:'panel1Div',
height:400,
items:[
new Ext.Button(action1),
new Ext.Button(action1),
{
text:'Regular button to invoke action1',
handler:function(){action1.execute();},
id:'btn',
xtype:'button'
}
]
})
});

ljung
17 Jul 2009, 8:48 AM
One THing that I also niticed is that if I create the 2 buttons the same way but in different panels, it will work