Search code examples
javascriptextjsextjs4

ExtJs - Change Textfield VType dynamically


A rather straightforward question. No answer found anywhere.

Using ExtJs 4.2

I have two custom VTypes, and one textfield. I want to change that textfield's vtype when the user clicks a radio button.

I know that the text field has already been created so doing:

textfield.vtype = 'otherType';

won't do it for me. Neither will:

Ext.apply(textField,{vtype:'otherType'});  

So the obvious stuff is out. Now I'm toying with destroying and re-creating it, but (if it even works) that seems like overkill.


Solution

  • Using Ext.apply worked for me, fiddle here: https://fiddle.sencha.com/#fiddle/4d4

    Hope this helps..