ExtJS过滤器的错误与组合框
ExtJS filter bug with comboboxes
我的ExtJS应用程序有一个问题。首先是代码
var typeStore = Ext.create('Ext.data.Store', {
fields: ['id', 'name'],
data: [
{id: 1, name: 'type1'},
{id: 2, name: 'type2'}
]
})
var mainStore = Ext.create('Ext.data.Store', {
fields: ['id', 'name', 'typeId'],
data: [
{id: 1, name: 'item1', typeId: 1},
{id: 2, name: 'item2', typeId: 1},
{id: 3, name: 'item3', typeId: 2},
{id: 4, name: 'item4', typeId: 2}
]
})
Ext.application({
name : 'Fiddle',
launch : function() {
// Ext.Msg.alert('Fiddle', 'Welcome to Sencha Fiddle!');
Ext.create('Ext.container.Viewport', {
items: [
Ext.create('Ext.form.ComboBox', {
fieldLabel: 'type',
store: typeStore,
valueField: 'id',
displayField: 'name',
listeners: {
select: function(combo, records, eOpts)
{
mainStore.clearFilter();
mainStore.filter([
Ext.create('Ext.util.Filter',
{
filterFn: function(record)
{
console.dir(record);
var mainId = record.get('id');
var typeId = record.get('typeId');
var type = records[0].get('id');
var tmpRes = (typeId == type);
return tmpRes;
},
root: 'data'
})
])
}
}
}),
Ext.create('Ext.form.ComboBox', {
fieldLabel: 'item',
store: mainStore,
valueField: 'id',
displayField: 'name'
})
]
})
}
});
你有两个组合框。第一个字段的值应该过滤第二个字段。当您在第一个框中选择一个条目时,它会正确过滤第二个框,直到您在第二个框中选择一个条目。当您再次更改第一个组合框中的值时,第二个组合框中将没有条目。
不知何故,过滤器没有重置。你有什么办法解决这个问题吗?
我使用ext 4.2.1。
只需添加queryMode: 'local'
.这里是更新的小提琴:简单的小提琴
相关文章:
- Node.js v6.2.0类扩展不是函数错误
- Jquery菜单操作不稳定,定位不正确,存在一般错误
- document.open/document.write没有正确地清除chrome中的文档——这是chrome的错误吗
- 试图在引导模式内动态生成图表,得到offsetWidth错误
- 根据id将json数组组合为一个json数组
- 为什么会出现错误;未捕获的类型错误:undefined不是函数;
- 类型错误:url未定义extjs 4正在填充组合框
- 在单独加载时运行良好的组合javascript中可能导致错误的原因
- 什么's是在Node.js中公开和组合错误的最佳方式
- jquery autocomplete组合框错误:未捕获类型错误:Object[Object Object]没有方法
- jQuery 选择错误:添加新的选择字段并对其进行组合时出现问题
- 设置extjs 6组合框's在运行时存储数据会导致显示错误
- 我的级联组合框发送错误的值
- javascript:错误组合DOM "id"和“;name"
- gulp-concat 和 lazypipe 的这种组合在使用 gulp 4 时会导致错误
- jQuery Validate将错误作为单独的实例处理,而不是将它们组合在一起
- ExtJS过滤器的错误与组合框
- 使用复选框+标签组合防止双击错误
- 组合来自多个javascript块的代码会导致错误
- ExtJS 4.2 - Tab 在组合框中选择错误的值,键入快速键入时为 typeAhead:true