解决Gxt ComboBox控件设置值问题

问题代码:

 

//初始化数据源
ListStore <ComBoModel> store = new ListStore <ComBoModel> ();
store.add (new ComBoModel ("Android", "0"));
store.add (new ComBoModel ("Smart","1"));
store.add (new ComBoModel ("Google","2"));
//初始化Combobox
ComboBox <ComBoModel> combobox = new ComboBox <ComBoModel> ();
combobox.setDisplayField ("name");
combobox.setValueField ("value");
combobox.setStore (store);


//在另外一个方法中设置value值
 combobox.setValue (new ComBoModel ("Smart","1") );

 问题描述:当设置value后。点击下拉列表发现另外两条记录消失。只剩下Smart这条记录可供选择。

 

 

解决方案:

    在ComboBox初始化时做如下设置

 

combobox.setTriggerAction (TriggerAction.ALL);
 

 

你可能感兴趣的:(android,Google)