如何在Sencha Touch中的Selectfield上重置或取消选择突出显示项目



美好的一天!

选择一个项目后,我需要重置或取消选择项目的选择。

以下是我的代码:

xtype: 'selectfield',
id: 'slActionRequired',
placeHolder: 'SELECT ACTION REQUIRED',
name: 'ActionRequired',
label: 'Action Required<span style="color:red">*</span>',
autoSelect: false,
usePicker: false,
options: [
{ text: 'YES', value: 'YES' },
{ text: 'NO', value: 'NO' }
],

我尝试了以下代码,但没有任何作用:

Ext.ComponentQuery.query('#slActionRequired')[0].reset()
Ext.ComponentQuery.query('#slActionRequired')[0].setValue('');

任何帮助都将不胜感激。

谢谢

您可以扩展Ext.Field.Select类并在ShowPicker函数中修改项目选择。

Ext.define('Ux.field.Select', {
    extend: 'Ext.field.Select'
    xtype: 'myselectfield',

    showPicker: function() {
      ...
     // Modify the last line of the showPicker function
     // Remove the item selection when the select field is displayed.
     //list.select(record, null, true);

    }
}

最新更新