//頁面彈窗
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中的格式一樣,無需前綴!