<script type="text/javascript">
var table = new AW.CSV.Table;
table.setURL("URLTOCSV");
table.request();
var obj = new AW.Grid.Extended;
obj.setColumnCount(50);
obj.setId("myGrid");
obj.setHeaderCount(2);
obj.setHeaderHeight(40, 0); // header row-0
obj.setHeaderHeight(30, 1); // header row-1
obj.setFixedLeft(4);
obj.setCellModel(table);
document.write(obj);
</script>
var table = new AW.CSV.Table;
table.response = function(text){
this._rows = text.split(/\r*\n/);
if (!this._rows[this._rows.length-1]){
this._rows.pop();
}
this._data = [];
if (this.$owner) {
// grid initialization
this.$owner.clearScrollModel();
this.$owner.clearSelectedModel();
this.$owner.clearSortModel();
this.$owner.clearRowModel();
// copy data to grid headers
var i, max = this.$owner.getColumnCount();
for (i=0;i<max;i++){
this.$owner.setHeaderText(this.getData(i, 0), i, 0); // 1st row
this.$owner.setHeaderText(this.getData(i, 1), i, 1); // 2nd row
}
// remove first 2 rows from data arrays
this._rows.splice(0, 2);
this._data.splice(0, 2);
// continue grid initialization
this.$owner.setRowCount(this.getCount());
this.$owner.refresh();
}
};
// then as usual...
This topic is archived.