GridPanel filtering issue
I have a GridPanel with a toolbar used to filter the grid's contents, the filter works on the first attempt however, if you change the filter criteria it always displays the same data. I have checked the POST data with FireBug and it is always posting the same data, so the issue is definitely in the ext. I have been attempting to fix this for several days, so any help you can provide would be appreciated.
Code is below
Code:
osTransactions.superclass.constructor.call(
this, {
title:
'Transactions',
iconCls:
'fam_table_multiple',
store: transactions,
columns: [
{width: 23, dataIndex:
'', fixed: true, menuDisabled: true},
{header:
"Date", width: 75, sortable: false, dataIndex: 'date', hideable: false},
{header:
"SKU", width: 160, sortable: false, dataIndex: 'sku', hideable: false},
{id:
'description', width: 160, header: "Description", sortable: false, dataIndex: 'description', hideable: false},
{header:
"Quantity", width: 75, sortable: false, align: 'center', renderer: this.renderQty, dataIndex: 'qty', hideable: false},
{header:
"Department", width: 150, sortable: false, align: 'left', dataIndex: 'dept', hideable: false},
{header:
"Cost", width: 100, sortable: false, align: 'left', dataIndex: 'cost', hideable: false, renderer: 'usMoney', summaryType:'pass', summaryRenderer: totalCostSummary},
{header:
'Vendor', width: 200, sortable: false, dataIndex: 'vendor', hideable: false}
],
sm:
new Ext.grid.RowSelectionModel({singleSelect:true}),
plugins: [summary],
tbar: [
new Ext.Toolbar.TextItem(
' Department: '
), departmentsCombo,
'-',
new Ext.Toolbar.TextItem(
' Vendor: '
), vendorsCombo,
'-',
new Ext.Toolbar.TextItem(
' From: '
), start_date,
'-',
new Ext.Toolbar.TextItem(
' To: '
), end_date,
'-',
{id:
'filter', text: 'Filter', tooltip: 'Filter the list', iconCls: 'fam_arrow_refresh', handler: this.filterList, scope: transactions},
'->',
{id:
'tb_pdf' , text: 'Export', tooltip: 'Export Transactions List to Excel', iconCls: 'fam_excel', handler: this.toPDF, scope: this}
],
bbar:
new Ext.PagingToolbar({
pageSize: 100,
store: transactions,
displayInfo:
true,
displayMsg:
'Displaying transactions {0} - {1} of {2}',
emptyMsg:
"No transactions to display"
})
});
this.getView().getRowClass = function(record, index)
{
return (record.get('dept_id') == -1) ? 'row-adjust' : (record.get('qty') < 0 ) ? 'row-take' : 'row-put';
};
};
Ext.extend(osTransactions, Ext.grid.GridPanel, {
renderQty :
function(val)
{
if(val > 0){
return'<span style="color:green;">' + val + '</span>';
}
elseif(val < 0){
return'<span style="color:red;">' + (val*-1) + '</span>';
}
return val;
},
filterList:
function(c){
this.baseParams.DEPT = this.departmentsCombo.getValue();
this.baseParams.VENDOR = this.vendorsCombo.getValue();
this.baseParams.FROM = Ext.util.Format.date(this.start_date.getValue(), "Y-m-d H:i:s.u");
this.baseParams.TO = Ext.util.Format.date(this.end_date.getValue(), "Y-m-d H:i:s.u");
this.reload()
},
clearFilter:
function(){
this.reset();
this.transactions.baseParams.DEPT = "";
this.transactions.reload()
},
///
b.enable();
},
// disable the default context menu
afterRender :
function(){
osInventory.superclass.afterRender.call(
this);
this.el.on('contextmenu', function(e){
e.preventDefault();
});
}
});