Extjs 6 -过滤器网格与组合框
Extjs 6 - Filter grid with combobox
我想用组合框对网格进行排序,我想当我选择组合框上的值时,网格的内容会改变,例如type
,有人能帮助我吗?由于
这是我的代码片段:
Ext.create('Ext.grid.Panel', {
height: 400,
title: 'Simpsons',
store: pagingStore,
columns: [{
text: 'Name',
dataIndex: 'name'
}, {
text: 'Email',
dataIndex: 'email'
}, {
text: 'Phone',
dataIndex: 'phone'
},
{
text: 'Type',
dataIndex: 'type'
}],
bbar: {
xtype: 'pagingtoolbar',
store: pagingStore,
displayInfo: true,
items: [
'-', {
xtype: 'combo',
fieldLabel: 'List account',
labelAlign: 'right',
store: storeCombo,
displayField: 'name'
}]
},
renderTo: Ext.getBody()
});
您可能想要这样的内容:
Ext.create('Ext.grid.Panel', {
height: 400,
title: 'Simpsons',
store: {
fields: ['name', 'email', 'phone', 'type'],
data: [{
name: 'Homer',
email: 'homer@simpsons.com',
phone: '111-222-333',
type: 'Foo'
}, {
name: 'Marge',
email: 'marge@simpsons.com',
phone: '111-222-334',
type: 'Foo'
}, {
name: 'Bart',
email: 'bart@simpsons.com',
phone: '111-222-335',
type: 'Bar'
}, {
name: 'Lisa',
email: 'lisa@simpsons.com',
phone: '111-222-336',
type: 'Bar'
}]
},
columns: [{
text: 'Name',
dataIndex: 'name'
}, {
text: 'Email',
dataIndex: 'email'
}, {
text: 'Phone',
dataIndex: 'phone'
}, {
text: 'Type',
dataIndex: 'type'
}],
bbar: {
xtype: 'toolbar',
items: [
'-', {
xtype: 'combo',
fieldLabel: 'List account',
labelAlign: 'right',
forceSelection: true,
emptyText: '-- Select --',
store: {
fields: ['type'],
data: [{
type: 'Foo'
}, {
type: 'Bar'
}]
},
displayField: 'type',
valueField: 'type',
listeners: {
change: function(combo, value) {
var grid = this.up('grid'),
store = grid.getStore();
if (!value) {
store.getFilters().removeAll();
} else {
store.filter([{
property: 'type',
value: value
}]);
}
}
}
}
]
},
renderTo: Ext.getBody()
});
https://fiddle.sencha.com/小提琴/1 hn4
相关文章:
- 当在EXTJS中的网格中使用时,afterrender不适用于组合框
- 如何在javascript中设置网格组合框值
- RefreshFilter在DHTMLX网格中不起作用.当我使用自定义组合框时
- 在组合框筛选后执行回调网格视图
- 剑道网格:如何在与Angular一起使用时从组合框单元格模板中获取所选项目
- Extjs 网格列 - 组合在值更改后显示键而不是值
- 网格中的组合框
- 具有多个网格和组合的hbox/vbox布局的ExtJS窗口在Internet Explorer上渲染得非常慢
- Javascript 不会检查文本输入值是否随组合网格而变化
- 节点 - 用于发送电子邮件的选项,发送网格和节点邮件之一或组合
- 如何在 ExtJS5 中网格编辑器组合的当前记录中添加项目
- 如何使用网格配置Kendo UI组合框
- 需要在剑道网格内的组合框中进行验证
- Sencha ExtJS 4.2:如何在一个网格中同步两个组合编辑器
- 如何将组合框用作剑道 UI 网格列
- easyUI数据网格内部编辑组合框无法选择默认值
- 剑道网格内的剑道组合框编辑不起作用
- 在extjs网格中添加只有一行的组合框
- 在ExtJS网格面板中,如何使用ChainedStore和widgetcolumn来显示每行具有不同值的组合框
- Extjs网格与可编辑的组合框列