更新或重新加载ExtJs ComboBox的存储

use*_*514 14 extjs

我想知道如何更新或重新加载ExtJs ComboBox的列表值的方法.例如,我有一些复选框.这些复选框确定ComboBox应具有的值.因此,在选择其中一些之后,我点击了drowndown列表(组合框)来查看值.

简而言之,我如何更改ComboBox已有的值(存储).

希望可以有人帮帮我

谢谢

Rob*_*rto 14

我一直在使用这个未记录的ExtJs API函数来在运行时更改存储:

mycombobox.bindStore(newStore);
Run Code Online (Sandbox Code Playgroud)

正如支持团队在http://www.sencha.com/forum/showthread.php?40749-Change-Combobox-store-data-update中所述.

编辑:如果我想在填充商店时放入新数据,我会这样做

storeMyStore = new Ext.data.Store({
    ...
    listeners: {
        load: function(this, records, options) {
            cbMyCombo.bindStore( storeMyStore );
        }
    }
});
Run Code Online (Sandbox Code Playgroud)


It *_*unt 7

它有点像这样

{
  xtype: 'checkbox',
  //configs
  listeners : {
     checked : function (checkbox, checkedBool) {
         var yourCombo = Ext.getCmp(yourComboID);

         //I'm not sure what params you will need to reload the comboBox from your
         // service but hopfully this will give the jist of things. . .

         yourCombo.store.reload(
                  {   
                     params: 
                         {yourParam : checkedBool},
                         {yourRowID : rowID}
                    });
      }
 }
Run Code Online (Sandbox Code Playgroud)


Mac*_*bey 0

在复选框上的事件侦听器中,获取对 ComboBox 正在读取的存储的引用。然后调用其添加或删除函数,根据选中的复选框更新存储中的数据一旦 更新完成,调用doLayout()ComboBox 组件,它应该根据存储的当前状态重新呈现自身。

虽然我认为有一种方法可以让它在商店更新时自动更新——但我还没有使用过。