1. #1
    Sencha User
    Join Date
    Sep 2011
    Posts
    118
    Answers
    7
    Vote Rating
    5
    subimage is on a distinguished road

      0  

    Default Answered: Extending Ext.field.Text

    Answered: Extending Ext.field.Text


    I've been trying for the better part of an hour to extend Ext.field.Text to do the most SIMPLE thing.

    I'm basically trying to replicate a phone number field, that will insert the dashes in between area code, etc...so the number ends up looking like 555-555-1212.

    My first thought was to try and use the "listeners" config property on the field itself, but no matter what I do, I cannot get the "keyup" function to fire.

    My second thought was to try and extend Ext.field.Text in my own special view class, but I could not get that working either. Sencha kept complaining about an alias to "widget.phonefield".

    Does anyone have a working example of this, or any pointers?

  2. Perhaps this could help?

    http://www.sencha.com/forum/showthread.php?146135

    You may also find this helpful:

    http://docs.sencha.com/ext-js/4-0/#!...nableKeyEvents

    Without seeing your code it's difficult to judge what the problem around widget.phonefield might be. It sounds like you might be trying to use the class name as an xtype when you should be using the short version of the alias.

  3. #2
    Sencha Premium Member skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,596
    Answers
    542
    Vote Rating
    324
    skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future

      0  

    Default


    Perhaps this could help?

    http://www.sencha.com/forum/showthread.php?146135

    You may also find this helpful:

    http://docs.sencha.com/ext-js/4-0/#!...nableKeyEvents

    Without seeing your code it's difficult to judge what the problem around widget.phonefield might be. It sounds like you might be trying to use the class name as an xtype when you should be using the short version of the alias.

  4. #3
    Sencha User
    Join Date
    Sep 2011
    Posts
    118
    Answers
    7
    Vote Rating
    5
    subimage is on a distinguished road

      0  

    Default


    Thank you! "enableKeyEvents" is the hidden thing I was looking for. Thought I was going CRAZY.

    Now onto trying to see if I can subclass Ext.field.Text in the proper way so Sencha will load it.

  5. #4
    Sencha Premium Member skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,596
    Answers
    542
    Vote Rating
    324
    skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future

      0  

    Default


    Though I understand how you missed it, I think it's a little unfair to call it hidden. It is documented in the keyup event for a text field:

    http://docs.sencha.com/ext-js/4-0/#!...xt-event-keyup

Thread Participants: 1