How can I refresh my TableView in titanium?

放肆的年华 提交于 2019-12-13 05:43:49

问题


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();
  });
});

you can see tableview.insertRowBefore(3,row); and similar... i am not sure how to loop the entire thing and get the value... There are such four


回答1:


tableview.setData(tableview.data);


来源:https://stackoverflow.com/questions/5731461/how-can-i-refresh-my-tableview-in-titanium

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!