我有一個有很多記錄的網格。所以我想在每個列標題中添加過濾器以便輕鬆過濾所需的數據。我看到了sencha文檔中給出的例子。但是如何在Extjs 4.2版本中實現它。如何在其中使用UX類?有沒有插件可用?如何在extjs的網格列標題中添加過濾器?
我非常感謝你。
請幫幫我。
阿南德
我有一個有很多記錄的網格。所以我想在每個列標題中添加過濾器以便輕鬆過濾所需的數據。我看到了sencha文檔中給出的例子。但是如何在Extjs 4.2版本中實現它。如何在其中使用UX類?有沒有插件可用?如何在extjs的網格列標題中添加過濾器?
我非常感謝你。
請幫幫我。
阿南德
一個解決辦法是捕捉到「欄中單擊」一欄,讓你想過濾並把這個過濾器在網格存儲功能帕拉姆。
列實施例
{
header : "email",
dataIndex : 'email',
listeners : {
click: {
element: 'el', //bind to the underlying el property on the panel
fn: function(){
storeGrid.filter("email", /\.com$/); // email
storeGrid.sort('myField', 'ASC');
}
}
}
},
煎茶過濾:filter store
煎茶排序:sort store data
這是一個例子:
Ext.define('Webdesktop.view.admin.List', {
extend: 'Ext.grid.Panel',
alias: 'widget.admin_casoslist',
initComponent: function() {
var me = this,
filters = {
ftype: 'filters',
encode: false,
local: true
};
Ext.apply(me, {
title: 'gridTitle',
store: List_CasSos_Store,
filterable: true,
features: [filters],
closable: true, // fixme: need to set here, because has no effect in tabpanel defaults configuration
autoScroll: true,
columns: {
items:[
{
text: 'header1',
filter: {
type: 'string'
},
flex: 1,
dataIndex: 'relation_patron_paraine'
},{
text:'header2',
filter: {
type: 'list',
options: ['case4', 'case3', 'case2', 'case1']
},
hidden:true,
flex: 1,
dataIndex: 'etatsante'
},{
text:'header3',
filter: {
type: 'numeric'
},
hidden:true,
flex: 1,
dataIndex: 'revenumnsuel'
}
],
defaults : {
align: 'center'
}
}
});
me.callParent();
}
在控制研究ER:
uses: [
'Webdesktop.view.admin.List',
...
'Ext.ux.grid.FiltersFeature'
]
您需要添加到您的網格配置:
plugins: [{
ptype: 'gridfilters'
}],
然後在每一列:
filter: {type: 'string', dataIndex: 'passengerFullName'},
注意,過濾器依賴於商店是否會是遠程過濾器還是本地過濾器。
這裏看到更多的信息:http://docs.sencha.com/extjs/6.0.2-classic/Ext.grid.filters.Filters.html
在頭的grid
你需要聲明過濾器的陣列,然後發揮好電網使用的過濾器。然後寫
this.filters = new Ext.ux.grid.GridFilters({
filters:this.filter
}) ;
給該
this.plugins = [this.filters];
當你添加一個插件欄寫
gridEl.filter{
type: 'list',
dataIndex: "DATAINDEX",
local : local,
dataForFilter : data
};
如果您需要''Ext.ux.grid.FiltersFeature'' – Aminesrine
如何包括'我的應用程序中的'Ext.ux.grid.FiltersFeature'..? –
編輯過的答案。 – Aminesrine