Hi, I want to implement a jqxgrid where the columns to display are stored in a db table.
I tried:
var cols;
$.ajax({
url: ‘contracts/getColumnsName.php’, cache: false, type: ‘post’,
success: function (response) {
cols = response;
// php returns response as:
// [{text: “Full Name”, datafield: “fullName”, width: 100]}, {text: “e-mail”, datafield: “email”, width: 200]}]
}
});
$(“#vals”).jqxGrid( {
width: 680, height: 540, theme: ‘energyblue’, columnsresize: true, sortable: true,
columns: cols
});
well this is not working
what i think is that cols is expected to be object type. and if I alert( typeof(cols) ) inside ajax call, it returns “string”.
how can I solve this ?