:: 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 Active.Text.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 Active.Controls.Grid;
obj.setProperty("column/count", 5);

it is assigned our new external data model.

obj.setModel("data", table);

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

document.write(obj);

Comments

5 Dec 06
database data Hiren (12)
29 Jun 06
display data from database into a Grid Mohan (10)
23 Mar 06
Multiple CSV files Keith (2)
22 Dec 05
Loading Column Labels from a CSV file Jay Blackwood (5)
13 Dec 05
Bug in regular expression used for processing CSV and tab-separated data Anthony M. (6)
3 Nov 05
What is the difference between setProperty and setColumnProperty? Anthony M. (1)
16 Sep 05
Changing Loaded values? Frosty (0)
12 Jun 05
onmouseover is not woking after one month Seshadri (4)
10 May 05
Loading CSV Chad Sanders (0)
19 Apr 05
looks great, can the seperator be some thing else? Tomer Cohen (0)

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