Encouragement of ListView

Encouragement of ListView

Introduction of Titanium 3.1 ListView

Dd17014e380450cfed5d55ff20fa3dfd?s=128

Ryutaro Miyashita

July 14, 2013
Tweet

Transcript

  1. 20.

    var plain_template = { childTemplates: [{ type: "Ti.UI.Label", bindId: "myLabel",

    properties: { left: "10dp" }, events: { click: reportFunction } }] }; var list = Ti.UI.createListView({ templates: { plain: plain_template }, defaultItemTemplate: "plain" }); 5JUBOJVN΋͘΋͘ձJO/*'5: ςϯϓϨʔτͷઃఆ
  2. 21.

    var data = []; [1,2,3,4,5].forEach(function (idx) { data.push({ myLabel: {

    text: "Row #" + idx }, properties: { itemId: "item" + idx } }); }); var section = Ti.UI.createListSection({ items: data }); list.sections = [section]; 5JUBOJVN΋͘΋͘ձJO/*'5: ςϯϓϨʔτΛ࢖ͬͯΞΠςϜΛ࡞Δ
  3. 22.

    5JUBOJVN΋͘΋͘ձJO/*'5: list.addEventListener( "itemclick", function (e) { // Get clicked item

    reference var item = e.section.getItemAt(e.itemIndex); console.log(item.properties.itemId); // Replace clicked item e.section.UpdateItemAt(e.itemIndex, item); } ); -JTU7JFXͷΠϕϯτϋϯυϦϯά
  4. 30.

    -JTU7JFX 5BCMF7JFX ˚ "OESPJE   Y J1IPOF 4JNVMBUPS 

     Y J1IPOF   Y ୯Ґ<NT> 5JUBOJVN΋͘΋͘ձJO/*'5: