The dwr call returns a set of data which will have any number of specific columns. For example name, id, address. The address could be 1,2 or 3 like address1, address2 for first record and address1, address2, address3 for second data. My question is how to make the column name for jqgrid dynamic.
DataHandler.fetch(function(data){
resultSet = data;
jQuery("#table1").jqGrid({
datatype : "local",
data : resultSet,
height : 250,
width : 978,
sortable : false,
ignoreCase : true,
sortorder : "desc",
colNames : ['Email Date/Time','User Name', 'Department'] //want to make this dynamic
colModel : [ {
name : 'mailedOn',
index : 'mailedOn',
width : '18%',
align : 'center',
}, {
name : 'userName',
index : 'userName',
width : '18%',
align : 'left',
sorttype : 'text',
}],
rowList:[10,20,30],
pager : '#pager',
rowNum : 10,
altRows : true,
altclass: "myclass",
viewrecords : true
});
});
Any help ??