我正在尝试使用 Apple 的 Dashcode 组合一个移动网络应用程序。
我想使用圆角矩形列表作为我的用户的菜单界面,但是,我似乎无法更改动态列表中的各个行的标签。
这是我列表的 javascript:
var dayController = {
/* categoryList will display these items */
_rowData: ["iPods", "Macs", "Applications"],
/* categoryListController must implement the numberOfRows and prepareRow functions */
/* This method is used to find out how many rows should be in the list */
numberOfRows: function() {
return this._rowData.length;
},
/* categoryList calls this method once for every row. */
prepareRow: function(rowElement, rowIndex, templateElements) {
/*
templateElements contains references to all elements that have an id in the category template row.
We use the lines below to update the list with each category item in _rowData.
*/
if (templateElements.categoryLabel) {
templateElements.categoryLabel.innerText = this._rowData[rowIndex];
}
/* Assign an onclick handler that will cause the browser to go a page
showing all products related to this category item, when clicked
*/
var self = this;
var handler = function() {
/* Get the category item associated with this row */
var category = self._rowData[rowIndex];
};
rowElement.onclick = handler;
}
};
我希望能够将 rowData[] 分配为列表中行的标签,但我似乎无法让它工作。
我猜我需要用 prepareRow 函数改变一些东西,对吧?
有没有人成功使用带有 Dashcode 的 JQuery 来构建 Web 应用程序?也许这会是一个更好的方法。