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 88 89 90 91 92 93 94 95
| // shared reader
var reader = new Ext.data.ArrayReader({}, [
{name: 'Prop_Lib'},
{name: 'Commune_Code'},
{name: 'SectionPlan'},
{name: 'NumeroPlan'},
{name: 'Surface'},
{name: 'Libelle'}
]);
// Array data for the grids
Ext.grid.dummyData = [['Dupont','76360','Z','0001','15,00','Taillis']];
var grid_Pro = new Ext.ux.grid.RowActions({
initComponent:function() {
// Create RowActions Plugin
this.action = new Ext.ux.grid.RowActions({
header:'Actions'
,actions:[{
iconIndex:'action1'
,qtipIndex:'qtip1'
,iconCls:'icon-open'
,tooltip:'Open'
}]
,callbacks:{
'icon-plus':function(grid, record, action, row, col) {
Ext.ux.Toast.msg('Callback: icon-plus', 'You have clicked row: <b>{0}</b>, action: <b>{0}</b>', row, action);
}
}
});
// dummy action event handler - just outputs some arguments to console
this.action.on({
action:function(grid, record, action, row, col) {
Ext.ux.Toast.msg('Event: action', 'You have clicked row: <b>{0}</b>, action: <b>{1}</b>', row, action);
}
,beforeaction:function() {
Ext.ux.Toast.msg('Event: beforeaction', 'You can cancel the action by returning false from this event handler.');
}
});
// configure the grid
Ext.apply(this, {
store:new Ext.data.GroupingStore({
reader: reader,
data: Ext.grid.dummyData,
sortInfo:{field: 'Prop_Lib', direction: "ASC"},
groupField:'Prop_Lib'
}),
columns: [
{header: "Nom", width: 80, sortable: true, dataIndex: 'Prop_Lib'},
{header: "Commune", width: 40, sortable: true, dataIndex: 'Commune_Code'},
{header: "Section", width: 20, sortable: true, dataIndex: 'SectionPlan'},
{header: "Numero", width: 20, sortable: true, dataIndex: 'NumeroPlan'},
{header: "Surface", width: 20, sortable: true, dataIndex: 'Surface'},
{header: "Type", width: 40, sortable: true, dataIndex: 'Libelle'},
this.action
],
plugins:[this.action],
view: new Ext.grid.GroupingView({
autoFill: true,
forceFit:true,
groupTextTpl: '{text} ({[values.rs.length]} {[values.rs.length > 1 ? "Parcelles" : "Item"]})'
}),
}); // eo apply
// add paging toolbar
this.bbar = new Ext.PagingToolbar({
store:this.store
,displayInfo:true
,pageSize:10
});
// call parent
Example.Grid.superclass.initComponent.apply(this, arguments);
} // eo function initComponent
,onRender:function() {
// call parent
Example.Grid.superclass.onRender.apply(this, arguments);
// load the store
this.store.load({params:{start:0, limit:10}});
} // eo function onRender
// }}}
}); // eo extend
var pan_CadCenter = new Ext.Panel({
region: 'center',
items:[grid_Pro]
}); |
Partager