1
I am trying to make a function to call a GRID that will be different depending on the parameter I pass. This is the function:
$JQuery(document).ready(function() {
$.ajax({
url: "/main/conciliacao/gera-colunas/tabela/<?php echo $tabela ?>",
success: function(data, st) {
criaGrid(data);
},
error: function() {
alert("Erro ao retornar os valores das colunas");
}
});
});
function criaGrid(colM) {
$JQuery("#jqGrid").jqGrid({
url: "/main/conciliacao/gera-grid/processo/<?php echo $processo ?>/tabela/<?php echo $tabela ?>/id/<?php echo $id ?>",
datatype: "json",
colModel: [ colM ],
viewrecords: true,
width: 780,
height: 200,
rowNum: 30,
pager: "#jqGridPager"
});
}
My problem is that the Colm variable has what I need to create the grid columns, but if I call it in colModel: the function does not recognise the variable value.
What might be going on?
console.log(colM)
returns what?– André Ribeiro
Returns { label: 'id', name: 'id', width: 75 }, which is what I need. If I copy what comes in the console.log() and paste it into the code works perfectly, but if it stays in the variable it doesn’t
– SeF
Where exactly are you making this mistake? Inside
criaGrid
?– André Ribeiro
That, within the
criaGrid
in partcolModel: [ colM ],
– SeF