I have a textfield and I have a list. I want to populate the textfield with the record from a list selection. How can I make this happen? I'm doing the application in Sencha Touch.
Here is my list code:
var airports = new Ext.List({
    fullscreen: true,
    id: 'list',
    indexBar: false,
    itemTpl : '{firstName} {lastName}',
    listeners:{
       change: function() {
        var el = Ext.getDom('from'); 
        el.setValue(this.getValue())
       }
    },
    store: store
});
And here is my textfield code:
开发者_运维知识库{
    xtype: 'textfield',
    name : 'from',
    label: 'From',
    id: 'from',
    labelWidth: '23%',
    placeHolder: 'Search airport',
    readOnly : true,
    listeners: {'render': function(cmp) { 
            cmp.getEl().on('click', function( event, el ) {
                                NotiflyApp.views.viewport.setActiveItem('ListContainer', {type: 'fade'});
            });            
    }}
},
Okey, so I managed to solve it by reading this tutorial.
Here is the list code:
var fromAirports = new Ext.List({
    fullscreen: true,
    id: 'airportList',
    indexBar: false,
    itemTpl : '{airport} {IATAcode}',
    onItemTap: function(item, index) {
    var formField = NotiflyApp.views.formField;
    var selectedAirport = store.getAt(index).get('firstName');
    var selectedIATA = store.getAt(index).get('lastName');
    var from = Ext.ModelMgr.create(
        { from: selectedAirport + ' ' + selectedIATA }, 'Contact');
        NotiflyApp.views.formField.load(from);
        NotiflyApp.views.viewport.setActiveItem('formInput', {type: 'fade'});
        },
    store: store
});
Hope this helps! If you have problems implementing it please comment and I'll try to help you out!
I have the same as you ( I guess) - a list and a form - where I want to fill the fields with the items of my list
If is that what you want you can try this in a function onItemDisclosure :
      var dataName= record.store.data.getAt(index).data.dataName;
      var dataSurname= record.store.data.getAt(index).data.dataSurname;
Then in the form field you can try:
      Ext.getCmp('name').setValue(dataName);
      Ext.getCmp('surname').setValue(dataSurname);
I don't know if it's some kind of a big workaround but it worked for me :) I hope I could help!!
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论