[code="java"]
Ext.onReady(function() {
Ext.ns('app.grid');
var xg = Ext.grid;
var detailViewReader = new Ext.data.JsonReader({
idProperty: 'autoid',
root : 'items',
totalProperty: "results",
fields: [
{name: 'autoid', type: 'int',mapping:'autoid'},
{name: 'usePlanAutoId', type: 'int',mapping:'usePlanAutoId'},
{name: 'itemName', type: 'string',mapping:'itemName'},
{name: 'itemMoney', type: 'float',mapping:'itemMoney'},
{name: 'remark', type: 'string',mapping:'remark'}
]
});
var detailViewStore = new Ext.data.JsonStore({
autoLoad: true,
reader: detailViewReader,
//url : _path +"servlet/UsePlanDetailServlet?sign=json",
url : "test.json",
method : 'POST',
sortInfo: {field: 'autoid', direction: 'ASC'},
params:{
"capitalUsePlanAutoId" : ""
}
});
var pagingtoolbar = new Ext.PagingToolbar({
pageSize:_pageSize,
store:detailViewStore,
displayInfo:true,
displayMsg: '从{0}至{1},共{2}条记录',
emptyMsg:"No records to display"
});
var detailViewGrid = new xg.GridPanel({
store: detailViewStore,
columns: [
new Ext.grid.RowNumberer(),
{
header: '内码',
dataIndex: 'autoid',
width: 40,
sortable: true
},{
header: 'usePlanAutoId',
dataIndex: 'usePlanAutoId',
width: 40,
sortable: true,
hidden : true
},{
header: '项目名称',
dataIndex: 'itemName',
width: 150,
sortable: true
},{
xtype: 'numbercolumn',
header: '金额',
dataIndex: 'itemMoney',
format: '$0,0.00',
width: 100
},{
header: '备注',
dataIndex: 'remark',
align: 'center',
width: 150
}
],
id: "usePlanDetailViewGrid",
//totalProperty:"results",
//frame: true,
width: 800,
height: 450,
//region : "center",
//clicksToEdit: 1,
collapsible: false,
//animCollapse: false,
//trackMouseOver: false,
bbar : pagingtoolbar,
//enableColumnMove: false,
iconCls: 'icon-grid'
});
var CapitalUsePlanDetail = new Ext.Panel(
{
id : "UsePlanDetailOperationWin",
title : "明细",
iconCls : "btn-operation",
width : 600,
height : 500,
closeAction: 'hide',
region : 'center',
items : [
detailViewGrid
]
});
new Ext.Viewport( {
layout : 'border',
title : 'tttt',
items : [ CapitalUsePlanDetail ],
renderTo : Ext.getBody()
})
});
[/code]