//页面弹窗
var win = new Ext.Window({
layout:'fit',
width:1020,
height:600,
closeAction:'hide',
items:[confirm],//在弹窗中嵌套表格;
modal:true,
listeners : {
'hide':function(){
store.reload();
},
'show':function(){
}
},
buttons:[
{
text:'确认',
handler:function(){
}
},{
text:'取消',
handler:function(){
win.hide();
}
}]
});
//设定grid格式
var confirm = new Ext.grid.GridPanel({
store:personStore,
columns:[
{header:"商品编号",dataIndex:"Meta_productNo",width :100,align:'left',resizable:true,sortable:true },
{header:"商品名称",dataIndex:"Meta_productName",width :100,align:'left',resizable:true,sortable:true },
{header:"商品属性",dataIndex:"Meta_attribute",width :100,align:'left',resizable:true,sortable:true },
{header:"SKU编号",dataIndex:"Meta_sku",width :100,align:'left',resizable:true,sortable:true },
{header:"SKU颜色",dataIndex:"Meta_color",width :100,align:'left',resizable:true,sortable:true },
{header:"SKU规格",dataIndex:"Meta_standard",width :100,align:'left',resizable:true,sortable:true },
{header:"进货价(元)",dataIndex:"Meta_buyingPrice",width :100,align:'left',resizable:true,sortable:true},
{header:"批发价(元)",dataIndex:"Meta_tradePrice",width :100,align:'left',resizable:true,sortable:true },
{header:"零售价(元)",dataIndex:"Meta_retaillPrice",width :100,align:'left',resizable:true,sortable:true },
{header:"平台评估价(元)",dataIndex:"Meta_appraisePrice",width :100,align:'left',resizable:true,sortable:true },
],
layout:'fit'
});
//设定JsonStore
var personStore = new Ext.data.JsonStore({
method : "POST",
fields : ["Meta_productNo","Meta_productName","Meta_attribute","Meta_sku","Meta_color","Meta_standard","Meta_buyingPrice","Meta_tradePrice","Meta_retaillPrice","Meta_appraisePrice"] //与Grid1列一致,至少列名称一致
});
//重头戏=======加载后台json数据弹窗展示
var data = Ext.util.JSON.decode(response.responseText);
personStore.loadData(data);
win.show();
//后台的json格式直接返回跟JsonStore中的格式一样,无需前缀,例如:
[{"Meta_productNo":"20012111","Meta_productName":"凯旋1664 360全网通","Meta_attribute":"全网通","Meta_sku":"200121113344","Meta_color":"红色","Meta_standard":"8G-64G","Meta_buyingPrice":"0.000000","Meta_tradePrice":"0.000000","Meta_retaillPrice":"0.000000","Meta_appraisePrice":"0.000000"}]