1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
|
var filtreCommune;
function initGrid() {
var store = new Ext.data.JsonStore({
autoLoad : false,
totalProperty: 'total',
successProperty: 'success',
url: loadGridUrl,
remoteSort:true,
root: 'data',
fields: ['annee', 'commune', 'communeId']
});
var pt= new Ext.PagingToolbar({
store: store,
displayInfo: true,
pageSize: 20,
paramNames:{start: 'start', limit: 'limit', communeId : 'communeId'}
});
pt.on("beforechange",function(){
communeId = filtreCommune.getValue();
});
filtreCommune = new Ext.form.ComboBox({
displayField: 'libcommune',
forceSelection: true,
emptyText: 'Sélection',
store: new Ext.data.SimpleStore({
url: getCommunesUrl,
fields: ['idcommune', 'libcommune']
}),
hiddenName: 'communeId',
valueField: 'idcommune',
triggerAction: 'all',
fieldLabel: 'Commune',
width: 150,
allowBlank: true,
anchor: '90%',
lazyLoadForValue: true,
storeField: ['idcommune', 'libcommune'],
disabled: false ,
timeout : 10000000,
loadingText:'Chargement ...'
});
filtreCommune.on("select", function(newVal, oldVal) {
reloadResults();
});
filtreCommune.on("reset", function(newVal, oldVal) {
reloadResults();
});
grid = new Ext.grid.EditorGridPanel({
loadMask:true,
applyTo : 'grid-fiscalite',
store: store,
columns: [
{id:'annee',header: "Année", width: 63, sortable: true, dataIndex: 'annee'},
{header: "Commune", width: 88, sortable: true, dataIndex: 'commune'},
{dataIndex: 'communeId',hidden:true}
],
sm : sm,
stripeRows: true,
autoExpandColumn: 'annee',
autoHeight: true,
width:969,
height:500,
tbar: [ new Ext.menu.TextItem({ text: '| Commune : ', style: { padding: '5px' } }),filtreCommune],
//columnLines: true ,
title:'Fiscalités',
bbar: pt
});
return grid;
}
function reloadResults() {
grid.store.load({params:{start:0, limit:20, communeId : filtreCommune.getValue() , typeId : filtreTaxe.getValue()}});
} |
Partager