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

Hide tableviewrow and loop

$
0
0

Hi I would like to hide or show tableviewrow in terms of a field value. I explain, i know how to hide it statically. I put height 0. The best option is to show you.

My view I have 2 rows which i want to filter in terms of the value of the field. For example my row 1 has the fieltype's value 0 and the row 2 the fieldtype's value 1.

<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>
In my controller
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 =='0') {
                  $.textfield.data[0].rows[3].setHeight('0');
              }  
          fieldlist.next();
        }
    }
fieldlist.close();
db_contact.close();
I want to do it dynamically here i hide the row 4 but i want to loop, i tried but i don't find the correct way . i don"t want to show a date field each row for exemple. I hope it's understanding and apologize for my english ;)

Viewing all articles
Browse latest Browse all 8068

Trending Articles