PDA

View Full Version : Grid Filter plugin not working



ridasfa1
4 Feb 2010, 6:21 AM
Hello every body,
I am using the filter gird found in the examples folder in the extjs 3.1 folder
I attached the error that showed up in the firebug. does it tell that i have missed something
my code is :


isppro.patterns.PatternsGrid = function(opts) {
this.ctx = opts.ctx;

var encode = false; //? ***
var local = true; //? ***

var rowDesc = new Ext.data.Record.create([{
name: 'pattern',
type: 'string'
}, {
name: 'name',
type: 'string'
}, {
name: 'rate',
type: 'float'
}, {
name: 'domain',
type: 'string'
}, {
name: 'zoneId',
type: 'int'
}, {
name: 'callType',
type: 'string'
}]);

var ds = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({
url: this.ctx + 'bin/ratingPatterns/getPatternsList',
method: 'POST'
}),
reader: new Ext.data.JsonReader({
root: 'data',
sortInfo:{field:'rate', direction:'ASC'}
}, rowDesc)
});


this.filters = new Ext.ux.grid.GridFilters({
encode: encode,
local: local,
filters:[
{type: 'string', dataIndex: 'pattern'},
{type: 'string', dataIndex: 'name'},
{type: 'float', dataIndex: 'rate'},
{type: 'int', dataIndex: 'domain'},
{type: 'int', dataIndex: 'zoneId'},
{type: 'string', dataIndex: 'callType'}
]});
//*** new added
var createColModel = function (finish, start) {

var columns = [{
dataIndex: 'pattern',
header: 'Pattern',
filterable: true
}, {
dataIndex: 'name',
header: 'Name',
filterable: true
}, {
dataIndex: 'rate',
header: 'Rate',
filterable: true
}, {
dataIndex: 'domain',
header: 'Domain',
filterable: true
}, {
dataIndex: 'zoneId',
header: 'Zone',
filterable: true
}, {
dataIndex: 'callType',
header: 'Call Type',
filterable: true
}];

return new Ext.grid.ColumnModel({
columns: columns.slice(start || 0, finish),
defaults: {
sortable: true
}
});
};

var sm = new Ext.grid.RowSelectionModel({
singleSelect: true
});


this.btnDiscount = new Ext.Button({
text: 'Discount',
tooltip: 'Discount...',
iconCls: 'icon-edit',
minWidth: 100,
handler: this.onDiscount,
scope: this
});

isppro.patterns.PatternsGrid.superclass.constructor.call(this, {
title: 'Patterns',
region: 'center',
enableColumnResize: false,
ds: ds,
colModel: createColModel(6),
enableColLock: false,
tbar: [this.btnDiscount],
view: new Ext.grid.GroupingView(),
plugins: [this.filters], //for making filter
sm: sm,
frame: true,
enableHdMenu:true,
stripeRows : true,
listeners: {
render: {
fn: function(){
ds.load({
params: {
start: 0,
limit: 50
}
});
}
}
},
bbar: new Ext.PagingToolbar({
store: ds,
pageSize: 15,
plugins: [this.filters]
})
});

this.on('rowdblclick', this.onRowDbClick);
}

Ext.extend(isppro.patterns.PatternsGrid, Ext.grid.GridPanel, {
onDiscount: function() {
alert(this.ds.reload());
alert('Do discount function here');
},
onRowDbClick: function() {
alert('hello extjs');
}
});


thank you

4 Feb 2010, 2:26 PM
Please use code tags in the future!