简体   繁体   中英

Hide tableRow in android with titanium appcelerator?

i need to hide custom table row in android by using titanium appcelerator i am creating the table row with some ui controls when i hide the particular row the whole row will not shown and UI adjust based on remaing rows for that i write the following code.

Ti.UI.backgroundColor = 'white';
var win = Ti.UI.createWindow();


var row1 = Ti.UI.createTableViewRow({
    height:'auto',
    selectionStyle:Ti.UI.iPhone.TableViewCellSelectionStyle.NONE
});
var label1 = Titanium.UI.createLabel({
    text:'Username',
    left: 10
});
var usernametf = Ti.UI.createTextField({
    left: 100,
    right:10,
    hintText: 'username',
    textAlign:"right",
    borderStyle: Ti.UI.INPUT_BORDERSTYLE_NONE
});
var row2 = Ti.UI.createTableViewRow({
    height:'auto',
    selectionStyle:Ti.UI.iPhone.TableViewCellSelectionStyle.NONE
});
var label2 = Titanium.UI.createLabel({
    text:'Password',
    left: 10
});
var passwordtf = Ti.UI.createTextField({
    left: 100,
    textAlign:"right",
    hintText: 'reenter password',
    right:10,
    passwordMask:true,
    borderStyle: Ti.UI.INPUT_BORDERSTYLE_NONE
});

///row3



var row3 = Ti.UI.createTableViewRow({
    height:'auto',
    selectionStyle:Ti.UI.iPhone.TableViewCellSelectionStyle.NONE
});
var label23 = Titanium.UI.createLabel({
    text:'Password',
    left: 10
});
var passwordtf123 = Ti.UI.createTextField({
    left: 100,
    textAlign:"right",
    hintText: 'password',
    right:10,
    passwordMask:true,
    borderStyle: Ti.UI.INPUT_BORDERSTYLE_NONE
});






row2.hide();


row1.add(label1);
row1.add(usernametf);
row2.add(label2);
row2.add(passwordtf);
row3.add(label23);
row3.add(passwordtf123);
var data = [row1,row2,row3];




var table = Ti.UI.createTableView({
 // data: tableData
 data:data,

});


win.add(table);
win.open();

how i hide tablerow2 and adjust the ui of theremaining rows please see and let me know further details.

Thanks in Advance...... 

Delete the statement "row2.hide();"

Add the statement "table.deleteRow(1);" before "win.add(table);"

In deleteRow the parameter "1" is the index of row2.

So if you wanted to delete row1 instead of row2, the statement would be "table.deleteRow(0);"

Hope this helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM