我需要在面板本地的特定面板中自定义yes no combo,而不影响父yesnocombo框配置。有没有办法做到这一点?
我指的是我之前在Sencha论坛的另一个帖子中发布的表单,但没有人回答。网址是: http://www.sencha.com/forum/showthre...ng-Sencha-form
我试过了:
var myNewStore =[
"", "Yes", "Revoke"];
Ext.define('YesNoCombo',{
extend:'Ext.form.ComboBox',
store:myNewStore,
value:'',
emptyText:'Select...',
labelalign:'left',
labelWidth:550,
inputWidth:80,
allowBlank:true,
listeners:{
select:function(comp,record,index){
if(comp.getVelue() == "" || comp.getVale() ===" ")
comp.setValue(null);
}
}
});
但这打破了表格的格式。
有没有办法用这样的自定义变量创建本地组合:
var UserForm_BlahBlahBlah=Ext.create('YesNoCombo', {
name:"UserForm_BlahBlahBlah",
fieldLabel:"BlahBlahBlah",
values:" Yes" "Revoke",
});
我尝试了这个,但它不起作用。但是你明白了 - 它只是在具有新值的特定面板中创建本地扩展。
这可能吗?或者,有没有更好的方法,即sencha实现自定义组合框而不影响父类?
此致 umbre gachoong
答案 0 :(得分:1)
您可以轻松扩展Ext.form.ComboBox
类并创建自己的组合框类。然后你可以在表格中使用你的组合框。
在exmaple中,我使用我xtype
定义的alias: 'widget.yesNoCombo'
来创建自定义组合框。您还可以通过var combo = Ext.create('YesNoCombo');
Ext.define('YesNoCombo',{
alias: 'widget.yesNoCombo',
extend:'Ext.form.ComboBox',
store: ["No", "Yes", "Revoke"],
emptyText:'Select...',
allowBlank:true
});
Ext.create('Ext.form.Panel', {
renderTo: Ext.getBody(),
items:[
{
xtype: 'yesNoCombo',
fieldLabel:'Yes No Label',
name: 'combo',
},
{
xtype: 'textfield',
fieldLabel: 'Another field',
name: 'anotherField',
},
]
});