Dashcode 移动网络应用程序动态列表行标签

发布于 2024-09-14 23:28:13 字数 1460 浏览 4 评论 0原文

我正在尝试使用 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函数改变一些东西,对吗?

有人成功使用 JQuery 和 Dashcode 来构建 Web 应用程序吗?也许这将是一个更好的方法。

I'm trying to put together a mobile web app using Apple's Dashcode.

I would like to use a Rounded Rectangle List as a menu interface for my users, however, I cannot seem to change the various rows' labels in a dynamic list.

Here is the javascript for my list:

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;
}

};

I want to be able to assign the rowData[] as the labels for the rows in the lists, but I can't seem to get it to work.

I'm guessing I need to change something with the prepareRow function, right?

Has anyone successfully used JQuery with Dashcode to build a web app? Perhaps that would be a better approach.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

你是年少的欢喜 2024-09-21 23:28:13

呃,你不会在 css 而不是 javascript 中设置圆角矩形吗?

您可以使用 Dashcode 来制作网络应用程序,但还有其他替代方案,实际上现在有很多替代方案。然而,有一个名为 JQTouch 的 JS 框架,它构建在 JQuery 之上来执行此操作。 JQTouch 现在已被纳入 Extjs 中,并且全部重命名为 Sechcha Touch。我建议你看看这是一个更灵活的选择。

我发现 Dashcode 非常适合构建 Mac Widget,但对于基于 Web 的 iPxx 应用程序来说则受到更多限制。

Erm wouldn't you set the rounded rectangle in the css and not the javascript?

You can use Dashcode to make the web app but there other alternatives, rather a lot these days actually. However there was a JS framework called JQTouch, built on top of JQuery for doing this. JQTouch has now beed subsumed into Extjs and all of it rename Sechcha Touch. I would suggestyou go an look at that as a more flexible alternative.

I found Dashcode excellent for building Mac Widgets but much more limited for web based iPxx apps.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文