1
我需要基於特定條件的FILTER
我的網格。使用ArrayStore在本地過濾網格
例如;如果有3個字段,Name,age,school
。我需要在本地過濾網格,以便在網格中顯示所有學生的網格爲age
10。
我讀過這是可以實現的,如果我使用Ext.data.ArrayStore
。但我不知道如何將其應用於我的代碼。 My Store類看起來像這樣;
Ext.define('Project.store.Person',{
extend:'Ext.data.Store',
model:'App.model.Person',
proxy: {
type: 'ajax',
url : '/person.php'
}
});
My Model;如何使用Ext.data.ArrayStore
,以便在本地過濾列。想要顯示10
年的age
的所有學生。
**UPDATE**
GRID - 查看
this.columns = [
{
{ text: "Size", dataIndex: 'size' ,filter: {
type: 'list',
options: ['small', 'medium', 'extra large']
} }, ...
STORE
Ext.define('SerenExample.store.GridFilterExample',{
extend:'Ext.data.Store',
model:'App.model.GridFilterExample',
remoteFilter: false,
remoteGroup:true,
proxy: { ...
我沒有看到該複選框說過濾器,當我在尊重列單擊
UPDATE
Ext.define('SerenExample.view.GridFilterExample' ,{
extend: 'Ext.grid.Panel',
alias : 'widget.gridfilt',
features: [],
initComponent: function() {
this.store = 'GridFilterExample';
this.columns = [
{
...
更新2
GET http://localhost/SerenExample/feature/filters.js?_dc=1341677311248 404 Not Found 104ms
"NetworkError: 404 Not Found - http://localhost/SerenExample/feature/filters.js?_dc=1341677311248"
Ext.define('SerenExample.view.GridFilterExample' ,{
extend: 'Ext.grid.Panel',
alias : 'widget.gridfilt',
features: [ {ftype: 'filters',
autoReload: false,
local: true,
filters: [{
type: 'list',
dataIndex: 'status',
options: ['small', 'medium', 'extra large']
}]}],
initComponent: function() {
this.store = 'GridFilterExample';
this.columns = [
{
但我仍然無法看到複選框來過濾列。我在上面的帖子中添加了我的代碼。請看一看。 – 2012-07-07 15:00:21
這是完全不同的問題。我認爲你需要從代碼中過濾商店。如果您想使用網格過濾功能 - 請查看以下示例:http://dev.sencha.com/deploy/ext-4.1.0-gpl/examples/grid-filtering/grid-filter-local.html。從第一眼看 - 我認爲你在網格定義中缺少'features:[]'參數。 – sha 2012-07-07 15:20:11
是的,我看過那個例子。我有上面的代碼使用該示例。根據它的例子說'功能:[過濾器],'。我添加了'功能:[],'我的視圖類,但仍然沒有看到我點擊列時的複選框。我錯過了這裏的東西:S – 2012-07-07 15:29:48