estrify Posted April 22, 2013 Posted April 22, 2013 Hi Farshad, I need your wisdom... I am trying to use a ExtJS plugin attached to a form control, but the init function of the plugin never fires (the constructor fires ok)... what I am doing wrong??? 1. the plugin is in a file, loaded in server module correctly 2. the component is associated with the plugin within its OnBeforeRender client side event Is there any special considerations to keep in mind to use plugins in UniGUI?. It could be a bug? TIA, Quote
Administrators Farshad Mohajeri Posted April 22, 2013 Administrators Posted April 22, 2013 Hi Farshad, I need your wisdom... I am trying to use a ExtJS plugin attached to a form control, but the init function of the plugin never fires (the constructor fires ok)... what I am doing wrong??? 1. the plugin is in a file, loaded in server module correctly 2. the component is associated with the plugin within its OnBeforeRender client side event Is there any special considerations to keep in mind to use plugins in UniGUI?. It could be a bug? TIA, Can't say anything before seeing you code. Quote
estrify Posted April 23, 2013 Author Posted April 23, 2013 Hi, Here is a test case... You can see normal functionality opening html_sample\MyPlugin.html (simply one alert in constructor and another one in init). With UniGUI, only costructor alert is shown so the plugin doesn't run. What detail I'm overlooking? TIA 20130423_plugin.rar Quote
stas Posted April 23, 2013 Posted April 23, 2013 function OnBeforeInit(sender) { sender.plugins=Ext.create('Ext.ux.form.field.MyPlugin'); } 1 Quote
estrify Posted April 23, 2013 Author Posted April 23, 2013 function OnBeforeInit(sender) { sender.plugins=Ext.create('Ext.ux.form.field.MyPlugin'); } There are very good people in this forum ... Thank you very much ... Quote
Administrators Farshad Mohajeri Posted April 23, 2013 Administrators Posted April 23, 2013 plugins must be an array: sender.plugins=[ Ext.create('Ext.ux.form.field.MyPlugin', {option:"Value"} ) ]; Quote
Administrators Farshad Mohajeri Posted April 23, 2013 Administrators Posted April 23, 2013 http://docs.sencha.com/extjs/4.1.3/#!/api/Ext.AbstractComponent-cfg-plugins plugins : Ext.AbstractPlugin[]/Object[]/Ext.enums.Plugin[]2 An array of plugins to be added to this component. Can also be just a single plugin instead of array. Plugins provide custom functionality for a component. The only requirement for a valid plugin is that it contain an init method that accepts a reference of type Ext.Component. When a component is created, if any plugins are available, the component will call the init method on each plugin, passing a reference to itself. Each plugin can then call methods or respond to events on the component as needed to provide its functionality. Plugins can be added to component by either directly referencing the plugin instance: By using config object with ptype:plugins: ['cellediting', 'gridviewdragdrop'], 2 Quote
estrify Posted April 23, 2013 Author Posted April 23, 2013 http://docs.sencha.com/extjs/4.1.3/#!/api/Ext.AbstractComponent-cfg-plugins Thanks again... Quote
stas Posted April 23, 2013 Posted April 23, 2013 plugins must be an array: sender.plugins=[ Ext.create('Ext.ux.form.field.MyPlugin', {option:"Value"} ) ]; not necessarily, also works sender.plugins=Ext.create('Ext.ux.form.field.MyPlugin'); alert(sender.plugins[0]); Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.