【问题标题】:How to add a row at a particular index in titanium如何在钛的特定索引处添加一行
【发布时间】:2016-04-05 09:58:03
【问题描述】:

我有一张钛合金桌子,我添加了 3 行。在一种情况下,我从表 table.deleteRow(index) 中删除了第二行,经过一些处理后,我需要在该索引处添加一行。

谁能告诉我如何在特定索引处添加一行。

【问题讨论】:

    标签: appcelerator appcelerator-titanium


    【解决方案1】:
    【解决方案2】:

    这是我尝试过的一个示例,输出在屏幕截图中可见。

    Ti.UI.backgroundColor = 'white';
    var win = Ti.UI.createWindow();
    
    var tableData = [ {title: 'Apples'}, {title: 'Bananas'}, {title: 'Carrots'}, {title: 'Potatoes'} ];
    
    var table = Ti.UI.createTableView({
      data: tableData
    });
    win.add(table);
    win.open();
    
    table .insertRowAfter(3,{title: 'Inserted After'});
    table .insertRowBefore(0,{title: 'Inserted Before'});
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-03-29
      • 1970-01-01
      • 2011-07-05
      • 2017-10-29
      • 2014-03-26
      • 1970-01-01
      • 2019-02-17
      相关资源
      最近更新 更多