I have created a project in Dashcode, inserted a List control, enabled a dynamic list, created a JSON object and associated it with the control. The code looks like this ...
var stations = {
_rowData: ["Mitchelton", "Gaythorne", "Albion", "Central",
"Burpengary", "Petrie", "Morayfield", "Caboolture", "Ferny Grove"],
numberOfRows: function() { return this._rowData.length; },
prepareRow: function(rowElement, rowIndex, templateElements) {
if (templateElements.label) {
templateElements.label.innerText = this._rowData[rowIndex];
}
rowElement.onclick = function(event) { alert("Row "+rowIndex); };
}
As you can see when an item is selected it will print the rowIndex, but I would like to display the actual value at that index.
Unfortunately this (for example) "this._rowData[2]" doesnt work, it doesn't seem to be able to find the "_rowData" object.