ExtJS add FormPanel global listener or solution -


i'm using extjs 3.0 , extend formpanel or solution everytime show form, first field should focus. thinking of adding global listener (if such exists) perhaps:

afterrender: function() { ext.getcmp('formaddprogpaymentdoc').findbytype('textfield')[0].focus(); //// first textfield , focus } 

can done ? have more 40 forms , don't want add each 1 listener, it's listener automatically each one.

thanks.

create extoverrides.js file modify base functionality of ext. , add following code:

ext.override(ext.formpanel, {     onrender: function(ct, position){         this.initfields();         ext.formpanel.superclass.onrender.call(this, ct, position);         this.form.initel(this.body);          //begin edit of default functionality         var firstfielditem = this.getform().items.first();         if(firstfielditem){             //delay focus 500ms make sure field visible             firstfielditem.focus(true,500);         }         //end edit of default functionality     } }) 

you need careful when using extoverrides though - when update new versions of ext need verify update default functionality in override.


Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -