3.2.0

loading data from CSV into Grid

I am evaluating your product and I'm not able to load the grid from an external source. I tried several different methods with no success. I'm sure it's probably something I doing (or not doing). How can I debug my problem?
Scott
June 8,
I determined that the external file is being pulled by using the below code:

var req = new AW.HTTP.Request;
req.setURL('/mydir/awdata.csv');
req.response = function(text) {
alert(text); // do something with response here
};
req.request();
The data is displayed using the above code.

The below code is what I'm using that isn't working for me:

var table = new AW.CSV.Table;
//table.setProperty("URL", "excel.csv");
table.setURL("/mydir/awdata.csv");
table.request();

var obj = new AW.UI.Grid;

//obj.setCellText(myCells);
//obj.setColumnCount(5);
obj.setRowCount(10);
obj.setCellModel(table);

document.write(obj);

The grid box is painted/displayed but it is empty.

Any thoughts as to why the data is not being display in the grid?
Scott
June 8,
setColumnCount is required, so if you un-comment this line , the data should appear.

obj.setColumnCount(5);
Carlos
June 8,
I added the "obj.setColumnCount(5);" as you suggested and it still did not work, however, I removed the "obj.setRowCount(10);" and left the "obj.setColumnCount(5);" in and now it works.

Is there a problem with the "obj.setRowCount(10);" statement?
Scott
June 8,
The AW.CSV.Table class loads data asynchronously so when you set the number of rows to 10 and the data is not there yet - there is a problem.

AW.CSV.Table automatically sets the number of rows in response() method.
Alex (ActiveWidgets)
June 9,

This topic is archived.

See also:


Back to support forum