开发者

extjs add plugins to dynamic form fields

开发者 https://www.devze.com 2022-12-24 19:02 出处:网络
I am creating a form dynamically from the fields returned from server using json e.g. data is \"items\": [

I am creating a form dynamically from the fields returned from server using json e.g. data is

"items": [
    {"xtype": "textfield", "fieldLabel": "Name", "name": "name"}, 
    {"xtype": "textfield", "fieldLabel": "Description", "name": "description"}, 
    {"xtype": "textarea", "fieldLa开发者_开发技巧bel": "Text", "name": "text"}
],

Now I want to add a custom plugin to each field usually on client side I do this

plugins:new Ext.ux.plugins.MyPlugin()

but as my form fields are coming from server, how can I add plugin to field e.g. something like this (but that doesn't work)

"plugins": "Ext.ux.plugins.MyPlugin"


You can also register plugins with a "ptype":


MyPlug = Ext.extend(Object, {
    init : function(c){
        console.log('fire');
    }
});
Ext.preg('myplug', MyPlug);

new Ext.Component({
    plugins: [{ptype: 'myplug'}]
});
0

精彩评论

暂无评论...
验证码 换一张
取 消