dimanche 16 mars 2014

How to pass function argument to addListener

Ext.namespace('com.project');



com.project.setMaxLenght = function
(path, length){ var numberfield = Ext.ComponentQuery.query(path)[0];

numberfield.on({

"afterrender":function (fld, eOpts){

numberfield.inputEl.set({maxLength:length});

},

"change":function (fld, newValue, oldValue, opts){

numberfield.setValue(newValue.replace(/[^0-9]/g ,''));



}

});

};



com.project.setMaxLenght('numberfield[fieldLabel=Account No]',9);





I am getting length is undefined. How to pass argument to the object. should I use



numberfield.on(Ext.apply(



{"afterrender": ... code},9)



);




Aucun commentaire:

Enregistrer un commentaire