},
grid : {
xtype: 'Grid',
- xns: Roo.grid,
- autoExpandColumn : 'report_name',
- loadMask : true,
- listeners : {
- render : function()
- {
- _this.grid = this;
- //_this.dialog = Pman.Dialog.FILL_IN
- if (_this.panel.active) {
- this.footer.onClick('first');
- }
- },
- rowdblclick : function (_self, rowIndex, e)
- {
- if (!_this.dialog) return;
- _this.dialog.show( this.getDataSource().getAt(rowIndex).data, function() {
- _this.grid.footer.onClick('first');
- });
- }
- },
- dataSource : {
- xtype: 'Store',
- xns: Roo.data,
- remoteSort : true,
- sortInfo : { field : 'report_name', direction: 'ASC' },
- proxy : {
- xtype: 'HttpProxy',
- xns: Roo.data,
- method : 'GET',
- url : baseURL + '/Roo/report.php'
- },
- reader : {
- xtype: 'JsonReader',
- xns: Roo.data,
- totalProperty : 'total',
- root : 'data',
- id : 'id',
- fields : [
- {
- 'name': 'report_id',
- 'type': 'int'
- },
- {
- 'name': 'report_name',
- 'type': 'string'
- },
- {
- 'name': 'report_sys',
- 'type': 'int'
- },
- {
- 'name': 'report_source',
- 'type': 'string'
- },
- {
- 'name': 'report_descrip',
- 'type': 'string'
- },
- {
- 'name': 'report_grade',
- 'type': 'int'
- },
- {
- 'name': 'report_loaddate',
- 'type': 'date',
- 'dateFormat': 'Y-m-d'
- }
- ]
- }
- },
- footer : {
- xtype: 'PagingToolbar',
- xns: Roo,
- pageSize : 25,
- displayInfo : true,
- displayMsg : "Displaying report{0} - {1} of {2}",
- emptyMsg : "No report found"
- },
- toolbar : {
- xtype: 'Toolbar',
- xns: Roo,
- items : [
- {
- xtype: 'Button',
- xns: Roo.Toolbar,
- text : "Add",
- cls : 'x-btn-text-icon',
- icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
- listeners : {
- click : function()
- {
- if (!_this.dialog) return;
- _this.dialog.show( { id : 0 } , function() {
- _this.grid.footer.onClick('first');
- });
- }
- }
- },
- {
- xtype: 'Button',
- xns: Roo.Toolbar,
- text : "Edit",
- cls : 'x-btn-text-icon',
- icon : Roo.rootURL + 'images/default/tree/leaf.gif',
- listeners : {
- click : function()
- {
- var s = _this.grid.getSelectionModel().getSelections();
- if (!s.length || (s.length > 1)) {
- Roo.MessageBox.alert("Error", s.length ? "Select only one Row" : "Select a Row");
- return;
- }
- if (!_this.dialog) return;
- _this.dialog.show(s[0].data, function() {
- _this.grid.footer.onClick('first');
- });
-
- }
- }
- },
- {
- xtype: 'Button',
- xns: Roo.Toolbar,
- text : "Delete",
- cls : 'x-btn-text-icon',
- icon : rootURL + '/Pman/templates/images/trash.gif',
- listeners : {
- click : function()
- {
- Pman.genericDelete(_this, 'report');
- }
- }
- }
- ]
- },
- colModel : [
- {
- xtype: 'ColumnModel',
- xns: Roo.grid,
- header : 'Report',
- width : 75,
- dataIndex : 'report_id',
- renderer : function(v) { return String.format('{0}', v); }
- },
- {
- xtype: 'ColumnModel',
- xns: Roo.grid,
- header : 'Report name',
- width : 200,
- dataIndex : 'report_name',
- renderer : function(v) { return String.format('{0}', v); }
- },
- {
- xtype: 'ColumnModel',
- xns: Roo.grid,
- header : 'Report sys',
- width : 75,
- dataIndex : 'report_sys',
- renderer : function(v) { return String.format('{0}', v); }
- },
- {
- xtype: 'ColumnModel',
- xns: Roo.grid,
- header : 'Report source',
- width : 200,
- dataIndex : 'report_source',
- renderer : function(v) { return String.format('{0}', v); }
- },
- {
- xtype: 'ColumnModel',
- xns: Roo.grid,
- header : 'Report descrip',
- width : 200,
- dataIndex : 'report_descrip',
- renderer : function(v) { return String.format('{0}', v); }
- },
- {
- xtype: 'ColumnModel',
- xns: Roo.grid,
- header : 'Report grade',
- width : 75,
- dataIndex : 'report_grade',
- renderer : function(v) { return String.format('{0}', v); }
- },
- {
- xtype: 'ColumnModel',
- xns: Roo.grid,
- header : 'Report loaddate',
- width : 75,
- dataIndex : 'report_loaddate',
- renderer : function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }
- }
- ]
+ xns: Roo.grid
+ },
+ grid : {
+ xtype: 'Grid',
+ xns: Roo.grid
}
}
],