PDA

View Full Version : grid Filter in MVC



faliqulamin
3 Oct 2012, 4:33 AM
I was just learning MVC concepts in extjs, but my difficulty implementing the filtering grid in MVC concept, I've tried it several times but still there is an error in my application, is there anything that can give an example?



Ext.define('App.view.user.List' ,{
extend: 'Ext.grid.Panel',
alias : 'widget.userList',
id:'userID',
store: 'User',
title : 'Users',
layout: 'fit',
features: [{ftype: 'filters',
autoReload: true,
local: true}],
dockedItems: [{
xtype: 'toolbar',
items: [{
iconCls: 'user_add',
text: 'Add',
action: 'addUser'

},{
iconCls: 'user_delete',
text: 'Delete',
disabled: true,
itemId: 'deleteUser',
action: 'delete'
}]
},{
xtype: 'pagingtoolbar',
store: 'User', // mismo que el store GridPanel
dock: 'bottom',
displayInfo: true
}],

initComponent: function() {
this.columns = [
{header: 'ID', dataIndex: 'userID', flex: 1, filter: {type: 'numeric'}},
{header: 'Name', dataIndex: 'name', flex: 1, filter: {type: 'string'}},
{header: 'Last Name', dataIndex: 'lastname', flex: 1, filter: {type: 'string'}},
{header: 'Age', dataIndex: 'age', flex: 1, filter: {type: 'numeric'}}
];

this.callParent(arguments);
}
});





and sorry with my english

scottmartin
3 Oct 2012, 5:59 PM
Where are you trying to add your filter? View or controller?

Scott.

faliqulamin
4 Oct 2012, 4:54 AM
Where are you trying to add your filter? View or controller?

Scott.

thank's before.
i add my filter in view.
and this my grid panel code


Ext.define('App.view.user.List' ,{
extend: 'Ext.grid.Panel',
alias : 'widget.userList',
id:'userID',
store: 'User',
title : 'Users',
layout: 'fit',
features: [{ftype: 'filters',
autoReload: true,
local: true}],
dockedItems: [{
xtype: 'toolbar',
items: [{
iconCls: 'user_add',
text: 'Add',
action: 'addUser'

},{
iconCls: 'user_delete',
text: 'Delete',
disabled: true,
itemId: 'deleteUser',
action: 'delete'
}]
},{
xtype: 'pagingtoolbar',
store: 'User', // mismo que el store GridPanel
dock: 'bottom',
displayInfo: true
}],

initComponent: function() {
this.columns = [
{header: 'ID', dataIndex: 'userID', flex: 1, filter: {type: 'numeric'}},
{header: 'Name', dataIndex: 'name', flex: 1, filter: {type: 'string'}},
{header: 'Last Name', dataIndex: 'lastname', flex: 1, filter: {type: 'string'}},
{header: 'Age', dataIndex: 'age', flex: 1, filter: {type: 'numeric'}}
];

this.callParent(arguments);
}
});



Is there something wrong with my gridpanel and filter

scottmartin
4 Oct 2012, 7:50 AM
Have you included the path to Ext.ux.grid.FiltersFeature



Ext.Loader.setPath('Ext.ux', '../ux'); // path to where UX from your app root
Ext.require([
'Ext.grid.*',
'Ext.data.*',
'Ext.ux.grid.FiltersFeature'
]);


Scott.

faliqulamin
4 Oct 2012, 6:25 PM
Have you included the path to Ext.ux.grid.FiltersFeature



Ext.Loader.setPath('Ext.ux', '../ux'); // path to where UX from your app root
Ext.require([
'Ext.grid.*',
'Ext.data.*',
'Ext.ux.grid.FiltersFeature'
]);


Scott.

thanks. it works

vaibhavdarji
21 Nov 2013, 1:26 AM
I am also facing the same issue in my MVC app. I am using filter in my grid view. I have set the Ux path and require file in app.js