簡體   English   中英

訪問數組中的對象屬性

[英]Accessing my object properties in an array

    var row = Ti.UI.createTableViewRow({height:50});
    var rowData = [];
    row.add(PrimeSuiteUserName);
    row.add(PrimeSuiteUserPassword);
    Ti.API.info("HelloRow" +row);
    rowData[0] = Object.property1;
    rowData[1] = Object.property1;
    Ti.API.info("Hello" +rowData);

當我提醒行對象時,我得到了這個...

HelloRow[Ti.UI.TableViewRow]

如何訪問數組中的行對象屬性。

嘗試這個。

// section index
var sectionIndex = 0;

// row index
var rowIndex = 0

// without label or childfield
rowtitle = yourTableView.data[sectionIndex].rows[rowIndex].title;
Ti.API.info("HelloRow " +rowtitle);

// child index
var childIndex = 0;

// with label or childfield
var text = yourTableView.data[sectionIndex].rows[rowIndex].children[childIndex].text;
Ti.API.info("HelloRow " +text);

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM