:: Forum >> Version 2 >>

loading data from CSV into Grid

More information on this topic is available in the documentation section: /grid.howto.data/csv-text-file.html.

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
Thursday, June 8, 2006
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
Thursday, June 8, 2006
setColumnCount is required, so if you un-comment this line , the data should appear.

obj.setColumnCount(5);
Carlos
Thursday, June 8, 2006
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
Thursday, June 8, 2006
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)
Friday, June 9, 2006



This topic is archived.

Back to /grid.howto.data/csv-text-file.html

Documentation:

Forum search