在Sencha touch中的搜索字段上设置列表值

Set the list value on the searchfield in Sencha touch

本文关键字:设置 列表 字段 搜索 Sencha touch      更新时间:2023-09-26

我在控制器上有这个方法

   onResponsibleSuggestListTap: function (list, index, target, record, event, eOpts) {
    var activityGeneral = this.getActivityGeneral();
    //set the text field value
    activityGeneral.down('#responsible').setValue(record.get('value'));
    console.log(record.get('value'));
    //hide out floating list
    this.getResponsibleSuggest().destroy();
    //clear the drop down list
    this.onClearResponsibleField();
},

并且在视图中:

items: [
                {
                    xtype: 'container',
                    width: '60%',
                    padding: '0 3px 0 0',
                    items: [
                        {
                            xtype: 'searchfield',
                            itemId: 'responsibleSearchField',
                            placeHolder: 'introduces..."
                        }
                    ]
                }
       ]

但是我无法在点击搜索字段中的项目后设置值,我做错了什么??

非常感谢!

根据以下进行更改后尝试

activityGeneral.query('searchfield[itemId=responsibleSearchField]')[0].setValue(record.get('value'));