weixin_33701294 2019-12-21 19:32 采纳率: 0%
浏览 53

ExtJS组合框过滤器

I have two comboboxes. The first one is for selecting a region, and the second one is for selecting a province. The values that should appear in the province combobox will be based on the value selected in the region combobox.

Region combobox code:

xtype: 'combobox',
label: 'Region ID',
margin: '10 20',
flex: 1,
valueField: 'regionid',
displayField: 'regionname',
store: 'RegionStore',
minLength: 1,
id: 'region_id',
reference: 'region_id',
name: 'region_id',
listeners: {
  select: function(combo, value) {
    var id = Ext.getCmp('province'),
    store = id.getStore();

    if (!value) {
      store.getFilters().removeAll();
    } 
    else {
      store.filter('regionid', val)
    }
  }
}

Province combobox code:

label: 'Province',
margin: '10 20',
flex: 1,
queryMode: 'remote',
store: 'ProvinceStore',
valueField: 'provinceid',
displayField: 'provincename',
minLength: 1,
id: 'province',
name: 'province',
reference: 'province'

I'm not getting any errors but when I click the province combobox(assuming that I have already selected a value for the region combobox), the values displayed in the province combobox are not filtered, instead, all of the results are displayed. I have been on this for days. Is there someone who can help?

  • 写回答

1条回答 默认 最新

  • weixin_33724059 2019-12-22 12:44
    关注

    You are using queryMode: 'remote', so that your server returns the data. The frontend has no control, what is returned.

    Plus in your example val should be value.

    I would go with a chained store, that has a filter based on the selection.

    Here is a fiddle to show this: Fiddle

    This is duplicate to your other question

    评论

报告相同问题?

悬赏问题

  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料
  • ¥15 使用R语言marginaleffects包进行边际效应图绘制
  • ¥20 usb设备兼容性问题
  • ¥15 错误(10048): “调用exui内部功能”库命令的参数“参数4”不能接受空数据。怎么解决啊
  • ¥15 安装svn网络有问题怎么办