Extjs 使用ArrayStore本地过滤网格
我需要根据特定标准过滤我的网格 比如,;如果有3个字段,Extjs 使用ArrayStore本地过滤网格,extjs,extjs4,extjs-mvc,extjs4.1,Extjs,Extjs4,Extjs Mvc,Extjs4.1,我需要根据特定标准过滤我的网格 比如,;如果有3个字段,姓名、年龄、学校。我需要在本地过滤网格,以便它在网格中显示所有年龄10岁的学生 我了解到,如果我使用Ext.data.ArrayStore,这是可以实现的。但我不知道如何将其应用到我的代码中。我的商店类看起来像这样 Ext.define('Project.store.Person',{ extend:'Ext.data.Store', model:'App.model.Person', proxy: {
姓名、年龄、学校
。我需要在本地过滤网格,以便它在网格中显示所有年龄10岁的学生
我了解到,如果我使用Ext.data.ArrayStore
,这是可以实现的。但我不知道如何将其应用到我的代码中。我的商店类看起来像这样
Ext.define('Project.store.Person',{
extend:'Ext.data.Store',
model:'App.model.Person',
proxy: {
type: 'ajax',
url : '/person.php'
}
});
我的模型
Ext.define ('Project.model.Person',{
extend: 'Ext.data.Model',
fields:['name','age','school']
});
如何应用Ext.data.ArrayStore
,以便在本地筛选列。喜欢显示所有10
岁的学生
**UPDATE**
网格视图
this.columns = [
{
{ text: "Size", dataIndex: 'size' ,filter: {
type: 'list',
options: ['small', 'medium', 'extra large']
} }, ...
贮藏
当我单击“受尊重”列时,我没有看到显示filter的复选框
更新
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 = [
{
您不需要使用ArrayStore
。只需在存储定义中指定remoteFilter:false
,然后应用过滤器。它将在本地完成。您不需要使用ArrayStore
。只需在存储定义中指定remoteFilter:false
,然后应用过滤器。它将在本地完成。但我仍然无法看到筛选列的复选框。我已经在上面的帖子中添加了我的代码。请看一看,这是完全不同的问题。我想你需要从代码中过滤商店。如果要使用网格过滤功能,请检查此示例:。从第一眼看,我认为您的网格定义中缺少了特性:[]
参数。是的,我已经看过这个示例。我使用该示例获得了上面的代码。根据这个例子,它说功能:[filters],
。我在我的视图类中添加了功能:[],
,但当我单击该列时,仍然没有看到复选框。我在这里遗漏了一些东西:太棒了,你创建了过滤器对象吗?发布您的网格定义的代码com'n。。。您必须创建Ext.ux.grid.FiltersFeature
的对象,并将其传递到过滤器数组中。仔细看看那个样品。读了这篇文章,但我仍然看不到筛选列的复选框。我已经在上面的帖子中添加了我的代码。请看一看,这是完全不同的问题。我想你需要从代码中过滤商店。如果要使用网格过滤功能,请检查此示例:。从第一眼看,我认为您的网格定义中缺少了特性:[]
参数。是的,我已经看过这个示例。我使用该示例获得了上面的代码。根据这个例子,它说功能:[filters],
。我在我的视图类中添加了功能:[],
,但当我单击该列时,仍然没有看到复选框。我在这里遗漏了一些东西:太棒了,你创建了过滤器对象吗?发布您的网格定义的代码com'n。。。您必须创建Ext.ux.grid.FiltersFeature
的对象,并将其传递到过滤器数组中。仔细看看那个样品。也读一下这个
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 = [
{