Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

Show or hide tableViewRow

$
0
0

Hi ! i'm trying to show or hide TableViewRow. I know that i have to put the height to 0. But this is not my problem

my view

<Alloy>
    <Collection src="field"/>
    <Window id="addWin" title="New Form" class="container" modal="true">
        <TableView id="textfield" dataCollection="field" dataTransform="transform">
            <TableViewRow id="row">
                <TextField id="fieldvalue" hintText="{field_description}"></TextField>
            </TableViewRow>
            <TableViewRow id="rowDate">
                <Picker type="Ti.UI.PICKER_TYPE_DATE"/>
            </TableViewRow>
        </TableView>  
        <Button id="add" onClick="addForm">Add form</Button>
    </Window>
</Alloy>
I have 2 rows : a textfield and a date picker i would like to show or hide one of them in terms of the type.

In my controller i open my database which contain a field table

var db_contact = Ti.Database.open('contact');
if(db_contact){
    var fieldlist = db_contact.execute('SELECT fieldtype FROM field');
        while (fieldlist.isValidRow())
        {
          var fieldtype = fieldlist.fieldByName('fieldtype');     
              if(fieldtype =='1') {
                  $.textfield.data[0].rows[0].setHeight('0');
              }  
          fieldlist.next();
        }
    }
fieldlist.close();
db_contact.close();
my fieldtype is an int 0 is a field and 1 is a date for exemple. I tried to loop in a for loop with the number of Rows but it doesn't work. How can i do it or maybe there is a easier way to do it?

Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>