3.2.0

Using the first line of a CSV file as the headers?....Can it be done?

After reading through all the pages on this forum, I've not been able to find a solution to this.
Does anyone know if it's possible?
If not, is it possible to get the grid to "ignore" the first row?

As I don't know how many rows may be in the CSV file, I cannot use:
obj.setProperty("row/values", [1,2,3]);
obj.refresh();

I have tried to use getCount, to then build a setProperty loop, but it returns 0 all the time (possibly due to the data not being present at the request time).
Simon Bailey
March 31,
Check this posts:
/javascript.forum.2461.5/csv-to-array.html
/javascript.forum.2503.1/a-grid-that-can-load.html
Carlos
March 31,
I found the code below so I could use pipe delimited data. I considered doing what you suggested but have not implemented it yet. The =='error' test allows me to pass back error messages that show up as alerts. I had also considered passing column lengths is the second row. That would make the grid completely self configuring.

var MyColumns = [];

table.response = function(text) {
var i, s, rows = []
if (text.substr(0,5).toLowerCase() == 'error') {
alert(text);
}
else {
a = text.split(/\r*\n/);
MyColumns = a[0].split("|")
for (i=1; i<a.length; i++) {
if (a[i]) {
rows[i] = a[i].split("|");
}
}
}
this._data = rows;
Active.HTTP.Request.prototype.response.call(this);
};
Ken Gregg
March 31,

This topic is archived.

See also:


Back to support forum