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 96 97 98 99 100 101 102 103 104 105 106 107 108 109
|
ExtCart.grid = {};
ExtCart.grid.myStore = Ext.create('Ext.data.Store', {
storeId: 'myStore',
model: 'ExtCart.DefaultRecord',
groupField: 'type',
proxy: {[...]},
autoLoad : true,
stateful: true,
stateId: 'dataStoreSateId',
stateEvents: ["columnmove", "columnresize", "sortchange", "show", "hide"],
initStateEvents : function(){
this.colModel.on('hiddenchange', function(){ this.saveState; });
}
});
ExtCart.grid.myGrid = Ext.create('Ext.grid.Panel', {
viewConfig : {
plugins : {
ddGroup: 'GridExample',
ptype: 'gridviewdragdrop',
enableDrop: false
}
},
store: ExtCart.grid.myStore,
columns : ExtCart.grid.column.config,
enableDragDrop : true,
ddGroup : 'gridDDGroup',
features : [ExtCart.grid.groupingFeature],
frame : true,
multiSelect: true,
tbar: ExtCart.grid.tb,
listeners : {
viewready : function(component) {
if (typeof(hideStatus) != 'undefined' && hideStatus == true) {
for(i=0; i<component.columns.length; i++) {
var column = component.columns[i];
if (column.dataIndex == 'status') {
column.hide();
break;
}
}
}
}
},
stateful: true,
stateId: 'gridPanelStateId',
stateEvents: ["columnmove", "columnresize", "sortchange", "show", "hide"],
initStateEvents : function(){
this.colModel.on('hiddenchange', function(){ this.saveState; });
}
});
Ext.onReady(function(){
var viewport = Ext.create('Ext.container.Viewport', {
id: 'viewport',
layout:'border',
items:[{
region:'north',
id:'north-panel',
layout:'fit',
border: false,
preventBodyReset: true,
contentEl : 'navBar'
},{
region:'east',
id:'east-panel',
title: 'label',
layout:'fit',
width: 300,
minWidth: 100,
maxWidth: 800,
collapsible: true,
split : true,
preventBodyReset: true,
resizable : true,
margins:'0 0 0 0',
cmargins:'0 3 0 0',
items: [ ExtCart.grid.myGrid ],
stateful: true,
stateId: 'eastPanelStateID',
stateEvents: ["columnmove", "columnresize", "sortchange", "show", "hide"],
initStateEvents : function(){
this.colModel.on('hiddenchange', function(){ this.saveState; });
}
},{
region:'center',
id:'center-panel',
layout: 'fit',
border: false,
collapsible: false,
preventBodyReset: true,
contentEl : 'contentBox',
autoScroll:true
},{
region:'south',
id:'south-panel',
layout:'fit',
height:25,
contentEl : 'footer'
}]
});
}); |
Partager