I am using server-side pagination in the PQ grid. The column name will come dynamically from the server side as per my query string. I am fetching both the data and column from a single query. I am able to bind data to the grid but am not able to find any way to dynamically bind colModel to my grid. Please ref my code
//to get data from server side
var dataModel = {
location: "remote",
dataType: "JSON",
method: "GET",
url: stdFilterFetchData,
getData: function (dataJSON) {
var data = JSON.parse(dataJSON);
// column data from server side in json format
colModel = data.Data.model;
return {
curPage: dataJSON.curPage, totalRecords: dataJSON.totalRecords, data: data.Data.listData, colModel: data.Data.model };
},
};
//grid init
$('#tb_' + tableName).pqGrid({
width: 800, height: 450,
dataModel: model,
colModel: colModel,
freezeCols: 2,
pageModel: {
type: "remote",
rPP: 20,
strRpp: "{0}"
},
sortable: false,
selectionModel: { swipe: false },
wrap: false, hwrap: false,
numberCell: { resizable: true, width: 30, title: "#" },
title: "Shipping Orders",
resizable: true,
stringify: true
});