-1

どうすればこれを行うことができますか?

4

1 に答える 1

1

// このオブジェクトは、リストの dataSource メソッドを実装します。var listDataSource = {

// Sample data for the content of the list. 
// Your application may also fetch this data remotely via XMLHttpRequest.
_rowData: ["Item 1", "Item 2", "Item 3"],

// The List calls this method to find out how many rows should be in the list.
numberOfRows: function() {
    return this._rowData.length;
},

// The List calls this method once for every row.
prepareRow: function(rowElement, rowIndex, templateElements) {
    // templateElements contains references to all elements that have an id in the template row.
    // Ex: set the value of an element with id="label".
    if (templateElements.label) {
        templateElements.label.innerText = this._rowData[rowIndex];
    }

    // Assign a click event handler for the row.
    rowElement.onclick = function(event) {
        // Do something interesting
        alert("Row "+rowIndex);
    };
}

};

次に、インスペクターでデータ型を「動的」にすると、ラベル要素は作成したばかりの「listDataSource」になります...

于 2010-01-30T22:09:26.853 に答える