I am creating a form dynamically from the fields returned from server using json

extjs add plugins to dynamic form fields – Stack Overflow

0 down vote favorite

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", “fieldLabel": “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"

forms extjs
link|flag

asked Mar 29 at 7:00
Anurag Uniyal
10.3k21836

91% accept rate

1 Answer
oldest newest votes
up vote 1 down vote accepted

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’}]
});

發表迴響

你的電子郵件位址並不會被公開。 必要欄位標記為 *

What is 4 + 5 ?
Please leave these two fields as-is:
IMPORTANT! To be able to proceed, you need to solve the following simple math (so we know that you are a human) :-)