主页面相关的a.js代码中有一个button,在button的单击事件中,我想调用另外一个b.js文件,将一个window窗口显示出来,然后我将b.js中Ext.onReady(function(){....})直接修改为function b(){....},这样在单击事件中直接调用b(),确实是可以显示了.但是b.js中的一些元素在第一次的时候还能正常显示,但是下一次点击按钮弹出框的时候就无法正常显示了.... var byWeek = {
id:'week',
xtype: 'fieldset',
title: '每周几',
hidden : true,
height:100,
items: [
{
xtype: 'radiogroup',
id:'weekValue',
items: [
{boxLabel: '周一', name: 'week-auto',inputValue:'周一'},
{boxLabel: '周二', name: 'week-auto',inputValue:'周二'},
{boxLabel: '周三', name: 'week-auto',inputValue:'周三'},
{boxLabel: '周四', name: 'week-auto',inputValue:'周四'},
{boxLabel: '周五', name: 'week-auto',inputValue:'周五'},
{boxLabel: '周六', name: 'week-auto',inputValue:'周六'},
{boxLabel: '周日', name: 'week-auto',inputValue:'周日'}
]
}
] }; var page2Panel = new Ext.FormPanel({
title :'调度时间规则设定',
frame: true,
id:'p2',
labelWidth: 110,
width: 600,
bodyStyle: 'padding:0 10px 0;',
layout:'fit',
autoHeight:true,
items: [byWeek ]
});var wizardWindow = new Ext.Window({
title : '调度规则初始化向导',
width: 600,
height: 400,
border : true,
plain : true,
layout : 'fit',
closeAction:'hide',
x:300,
y:200,
items : [ wizardPanel],
buttons:[
{
text: upText,
id :'last',
handler:changePage
},
{
text: nextText,
id:'next',
handler:changePage
}
]
}); wizardWindow.show();
id:'week',
xtype: 'fieldset',
title: '每周几',
hidden : true,
height:100,
items: [
{
xtype: 'radiogroup',
id:'weekValue',
items: [
{boxLabel: '周一', name: 'week-auto',inputValue:'周一'},
{boxLabel: '周二', name: 'week-auto',inputValue:'周二'},
{boxLabel: '周三', name: 'week-auto',inputValue:'周三'},
{boxLabel: '周四', name: 'week-auto',inputValue:'周四'},
{boxLabel: '周五', name: 'week-auto',inputValue:'周五'},
{boxLabel: '周六', name: 'week-auto',inputValue:'周六'},
{boxLabel: '周日', name: 'week-auto',inputValue:'周日'}
]
}
] }; var page2Panel = new Ext.FormPanel({
title :'调度时间规则设定',
frame: true,
id:'p2',
labelWidth: 110,
width: 600,
bodyStyle: 'padding:0 10px 0;',
layout:'fit',
autoHeight:true,
items: [byWeek ]
});var wizardWindow = new Ext.Window({
title : '调度规则初始化向导',
width: 600,
height: 400,
border : true,
plain : true,
layout : 'fit',
closeAction:'hide',
x:300,
y:200,
items : [ wizardPanel],
buttons:[
{
text: upText,
id :'last',
handler:changePage
},
{
text: nextText,
id:'next',
handler:changePage
}
]
}); wizardWindow.show();
我在需要引用的js中定义了一个全局变量var Test=new Object,然后在需要调用的方法的地方这么定义
Test.test=fuction test(){....} 这样在主js文件中就可以直接使用Test.test来调用这个方法了......也是网上找到了..