Results 1 to 3 of 3

Thread: Set value of textfield with the value of the list on click

  1. #1
    Sencha User
    Join Date
    Mar 2012
    Posts
    16
    Vote Rating
    0
      0  

    Question Answered: Set value of textfield with the value of the list on click

    Hi!
    I have a List and a listener on click on the item, its works! But how to set the Value of textfield / numberfield with the value of the listener? I have tested many ways:

    The listener:
    Code:
    listeners: {
    							select: function(view, record) {
    								//Ext.Msg.alert('Selected!', 'You selected ' + record.get('firstName'));
    								//Ext.getDom('telefone').setValue(record.get('firstName'));
    								//alert(document.getElementById('telefone').length+' - '+document.getElementById('telefone').value+' - '+record.get('phoneNumber'));
    								//document.getElementById('telefone').value = record.get('phoneNumber');
    							}
    						}
    The field:
    Code:
    xtype: 'numberfield',
    	                                    label: 'Telefone:',
    										labelWidth: 105,
    	                                    name: 'telefone',
    	                                    id: 'telefone'
    Thanks! =)

  2. You need to resolve the Sencha Touch field not the element.

    You can use ComponentQuery to go up to the form and then down to the field you want using the up and down methods

  3. #2
    Sencha User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,062
    Answers
    3976
    Vote Rating
    1391
      0  

    Default

    You need to resolve the Sencha Touch field not the element.

    You can use ComponentQuery to go up to the form and then down to the field you want using the up and down methods
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Frontend Engineer
    ________________
    Need any sort of Ext JS help? Modus Create is here to help!

    Check out my GitHub:
    https://github.com/mitchellsimoens

  4. #3
    Sencha User
    Join Date
    Mar 2012
    Posts
    16
    Vote Rating
    0
      0  

    Wink

    This works!

    Thanks!

    The code:

    Code:
    var tab = this.up('tabpanel');								var form = tab.down('formpanel');
    								var field = form.down('numberfield');
    								field.setValue(record.get('phoneNumber'));
    =)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •