:: Home >>

Text file (CSV)

When the data is available in a plain text file (tabs or comma-delimited) you can load it into the grid without any server-side processing at all.

The file may look like this (click to open):

MSFT    Microsoft Corporation   "314,571.16"    "32,187.00" 55000
ORCL    Oracle Corporation  "62,615.27" "9,519.00"  40650
SAP SAP AG (ADR)    "40,986.33" "8,296.42"  28961
CA  Computer Associates Inter   "15,606.34" "3,164.00"  16000
ERTS    Electronic Arts Inc.    "14,490.90" "2,503.73"  4000
...

first step is to create an external data model object, which will load the data and provide a necessary interface for the grid to access it.

var table = new AW.CSV.Table;

The data model should know the URL of the file.

table.setProperty("URL", "/examples/data/companies.txt");

And you should ask the model to start loading the file.

table.request();

After the grid object is created

var obj = new AW.UI.Grid;
obj.setColumnCount(5);

it is assigned our new external data model.

obj.setCellModel(table);

Don't forget to write the grid HTML to the page as usual.

document.write(obj);

Comments

4 Dec 07
Encoding rendering metatdata in the source file? Duane Gran (1)
8 Jun 07
Thai Language incorrect present when load from CSV file to data-grid Nuttapon Tharachaikul (2)
26 Oct 06
Change Field Separator? Jeff (1)
9 Jun 06
loading data from CSV into Grid Scott (4)
25 May 06
Row # 21 with 'undefined' shown in Mozilla Carlos (1)

Comments will appear on this page and in the main forum.

Documentation:

Recent changes:

2.6.4
2.6.3
2.6.2
2.6.1
2.6.1
2.6.0
2.5.0 - 2.5.6
2.5.6
2.5.0 - 2.5.5
2.5.5