Using Grid with Ajax (ActiveWidgets)
I have that function that returns me a consultation of a table and in which I fill out an array (10 rows), in the grid he/she appears me only repeating 10 times the content of the first row.
function parseResults() {
var results = xmlHttp.responseText;
var json = eval("("+results+")");
var itens = null;
var codigocliente = "";
var nome = "";
RowCount=json.itens.length;
myData = new Array(json.itens.length);
for(var i = 0; i < json.itens.length; i++) {
codigocliente = json.itens[i].codigocliente;
nome = json.itens[i].nome;
// myData[i][0] = codigocliente;
myData[i] = nome;
nome=null;
alert(myData[i]);
}
grid.setColumnWidth([600]);
grid.setCellData(myData);
grid.setColumnCount(1);
grid.setRowCount(RowCount);
grid.refresh();
}
Where am I wandering?
And if I wanted to put many fields in the grid as I would do?
Thanks.
function parseResults() {
var results = xmlHttp.responseText;
var json = eval("("+results+")");
var itens = null;
var codigocliente = "";
var nome = "";
RowCount=json.itens.length;
myData = new Array(json.itens.length);
for(var i = 0; i < json.itens.length; i++) {
codigocliente = json.itens[i].codigocliente;
nome = json.itens[i].nome;
// myData[i][0] = codigocliente;
myData[i] = nome;
nome=null;
alert(myData[i]);
}
grid.setColumnWidth([600]);
grid.setCellData(myData);
grid.setColumnCount(1);
grid.setRowCount(RowCount);
grid.refresh();
}
Where am I wandering?
And if I wanted to put many fields in the grid as I would do?
Thanks.
Lourival Queiroz
September 2,