i have a component that extended from the filefield, and i added a custom property 'serverPath' to it ,and also i have defined the getter and setter .
code :
Ext.define('MyApp.ux.Field.File',{
extend:'Ext.form.field.File',
xtype:'myfilefield',
serverPath:'',
getServerPath:function(){
return this.serverPath;
},
setServerPath:function(serverPath){
this.serverPath = serverPath;
}
});
Ext.create('MyApp.ux.Field.File',{
bind:{
serverPath:'{serverPath}'
},
viewModel:{
type:'myViewModel'
}
});
i will not paste the myViewModel's definition . it is simple.
and it turned out that the binding does not take effect.
can anyone help ?
Your class should be:
Ext.define('MyApp.ux.Field.File',{
extend:'Ext.form.field.File',
xtype:'myfilefield',
config: {
serverPath:''
}
});
And you should be all set because ExtJS will create the setter and getter for you as well as the setter. In your view model make sure you have a:
data: {
serverPath : 'yourPathGoesHere'
}
Edited There are two things that were missing:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With