【问题标题】:How can I refresh my TableView in titanium?如何在钛中刷新我的 TableView?
【发布时间】:2011-04-20 13:53:25
【问题描述】:
PopupFirstNameButton.addEventListener('click', FirstNameFunction);
function FirstNameFunction(){
    infoWin.close();
    dispalyFirstName = 'false';
    var row = Ti.UI.createTableViewRow({
           className:'sectionrow',
           height:50
    }); 
    row.add(FirstNameTextField);  
    tableview.height = row.height + tableview.height;
    SearchForPatientsButton.top = tableview.height + 80;

    tableview.insertRowBefore(0,row);

    FirstNameTextField.addEventListener('click', function() {
        //DetailedPatientSearchWindow.close();
        var FirstNameWindow = Titanium.UI.createWindow({
          backgroundColor: '#1F561E',
          url:'FirstNameWindow.js'
      }).open();
    });
}


var PopupLastNameButton = Titanium.UI.createButton({
    backgroundColor:'#FFFFFF',
    bottom:160,
    left:25,
    width:270,
    height:40,
    title:'Last Name',
    color:'#000',
    borderRadius:5,
    font:{fontSize:16, fontWeight:'bold'}
});

PopupLastNameButton.addEventListener('click', LastNameFunction);

function LastNameFunction(obj){  
    infoWin.close();
    var row = Ti.UI.createTableViewRow({
           className:'sectionrow',
           height:50
    }); 
    row.add(LastNameTextField);  
    tableview.height = row.height + tableview.height;
    SearchForPatientsButton.top = tableview.height + 80;
    tableview.insertRowBefore(1,row);

    LastNameTextField.addEventListener('click', function() {
        //DetailedPatientSearchWindow.close();
        var FirstNameWindow = Titanium.UI.createWindow({
          backgroundColor: '#1F561E',
          url:'LastNameWindow.js'
      }).open();
    });
}

var PopupGenderButton = Titanium.UI.createButton({
    backgroundColor:'#FFFFFF',
    bottom:110,
    left:25,
    width:270,
    height:40,
    title:'Gender',
    color:'#000',
    borderRadius:5,
    font:{fontSize:16, fontWeight:'bold'}
});

PopupGenderButton.addEventListener('click', function() {
    infoWin.close();
    var row = Ti.UI.createTableViewRow({
           className:'sectionrow',
           height:50
    });
    row.add(GenderTextField);  
    tableview.height = row.height + tableview.height;
    SearchForPatientsButton.top = tableview.height + 80;
    tableview.insertRowBefore(2,row);
    GenderTextField.addEventListener('click', function() {
        var GenderWindow = Titanium.UI.createWindow({
          url:'GenderWindow.js',
          backgroundColor:'#1F561E'
      }).open();
  });
});

var PopupDateOfBirthButton = Titanium.UI.createButton({
    backgroundColor:'#FFFFFF',
    bottom:60,
    left:25,
    width:270,
    height:40,
    title:'Date of Birth',
    color:'#000',
    borderRadius:5,
    font:{fontSize:16, fontWeight:'bold'}
});

PopupDateOfBirthButton.addEventListener('click', function() {
    infoWin.close();
    var row = Ti.UI.createTableViewRow({
           className:'sectionrow',
           height:50
    });
    row.add(DateOfBirthTextField); 
    tableview.height = row.height + tableview.height; 
    SearchForPatientsButton.top = tableview.height + 80;
    tableview.insertRowBefore(3,row);
    DateOfBirthTextField.addEventListener('click', function() {
        var DateOfBirthWindow = Titanium.UI.createWindow({
          url:'DateOfBirthWindow.js',
          backgroundColor:'#1F561E'
      }).open();
  });
});

你可以看到tableview.insertRowBefore(3,row); 和类似的......我不知道如何循环整个事情并获得价值......有这样四个

【问题讨论】:

    标签: javascript titanium


    【解决方案1】:
    tableview.setData(tableview.data);
    

    【讨论】:

    • 如何设置 insertRowBefore(动态索引值而不是将其硬编码为 0、1、2 等)
    • 循环并增加索引值
    • 我刚刚更新了我的整个代码,我无法弄清楚...再次感谢
    • 我认为循环不会起作用,因为如果我们按计数做某事,该行会在按钮单击时添加......
    猜你喜欢
    • 2012-06-21
    • 2012-04-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多