ParamQueryGrid绑定数据

 

表格工具:https://paramquery.com/pro

<!---------------------------------------PQGrid引用----------------------------------------------->
<link href="../../scripts/pqgrid/pqgrid.min.css" rel="stylesheet" />
<link href="../../scripts/pqgrid/pqgrid.ui.min.css" rel="stylesheet" />
<link href="../../scripts/pqgrid/jquery-ui.min.css" rel="stylesheet" />
<link href="../../scripts/pqgrid/themes/bootstrap/pqgrid.css" rel="stylesheet" />
<script src="../../scripts/pqgrid/jquery-ui.min.js" type="text/javascript"></script>
<script src="../../scripts/pqgrid/pqgrid.min.js" type="text/javascript"></script>
<!--------------------------------------PQGrid引用------------------------------------------------>

 

function DataPQGrid(){

//var data = "[{'id':1,'code':'B001','color':'红色','pic':'','unit':'米','inventory':1,'status':0,'brand':'波司登','manufacturer':'波士顿','contact':'理','contactTel':'133','exp1':0,'exp2':12.00,'exp3':'','exp4':'','exp5':'','factoryid':1}]";
// var data=eval("(" + json + ")");
var obj = {
scrollModel: { autoFit: true },
numberCell: {show: false},
title: "面料明细",
selectionModel: { type: null },
pasteModel: { on: false },
sortModel: {on : false},
height: 'flex',
width:"80%",
// pageModel: { type: "local", rPP: 10 },
colModel:
[
{ title: "主键", width: 100, dataType: "integer", dataIndx: "id" ,hidden:true},
{ title: "面料编号", width: 100, dataType: "integer", dataIndx: "code" ,editor: false},
{ title: "颜色", width: 100, dataType: "string", dataIndx: "color",editor: false },
{ title: "品牌", width: 100, dataType: "float", align: "center", dataIndx: "brand",editor: false },
{ title: "库存", width: 100, dataType: "float", align: "center", dataIndx: "inventory",editor: false },
{ title: "消耗", width: 100, dataType: "float", align: "center", dataIndx: "fabricxh" },
{ title: "单位", width: 100, dataType: "float", align: "center", dataIndx: "unit",editor: false }
],
dataModel: {
// data:data
location: "remote",
type: 'post',
dataType: "text",
url: "HandlerAjax.ashx?action=get_fabric_json&factoryid="+$("#hidFactory").val()+"&stylecode="+$("#txtStyleCode").val(),
getData: function (dataJSON) {
var data = eval("(" + dataJSON + ")");
return {data: data };
}
},
selectChange: function (evt, ui) {
console.log('selectChange', ui);
var address = ui.selection.address();
$("#select_change_div").html(JSON.stringify(address));
}
};
$("#gridf_json").pqGrid(obj);
$("#gridf_json").pqGrid("refreshDataAndView");

}

posted @ 2017-04-21 12:03  会一  阅读(954)  评论(0编辑  收藏  举报