:: Forum >>
How to load CSV file and skip the header?
Hi,
I can load a CSV file using the following codes:
var table = new AW.CSV.Table;
table.setProperty('URL', 'myCsvFile.csv');
table.request();
var DataGrid = new AW.Grid.Extended;
DataGrid.setCellModel(table);
DataGrid.setColumnCount(3);
DataGrid.setHeaderText(["Head1", "Head1", "Head1"]);
But it will load the header line from the file, as a result, my first row in the data grid will be header!! How to I load the CSV file without loading the first line in it?
Thanks..
Peter
Peter
Friday, January 26, 2007
You can remove the headers in table.response() callback -
table.response1 = table.response;
table.response = function(text){
text = text.replace(/^.+\r*\n/, "");
this.response1(text);
}
Alex (ActiveWidgets)
Friday, January 26, 2007
Thanks a lot, Alex. It works perfectly!!
Peter
Friday, January 26, 2007
This topic is archived.
Back to support forum
Forum search