Consider an expanded and a collapsed View, one visible at a time, toggled on click events.
In a TableRowView, I can set the TableViewRow height and toggle between the expanded and collapsed Views. The views show, but the TSS styles are lost - for example, background color.
Here is an example Alloy project that demonstrates:
index.xml:
<TableView>
<TableViewRow id="row">
<View id="staticSection">
<Label>static section</Label>
</View>
<View id="collapsedView" onClick="expand">
<Label>collapsed</Label>
</View>
<View id="expandedView" onClick="collapse">
<Label>expanded</Label>
</View>
<View id="staticRuler">
</View>
</TableViewRow>
<TableViewRow>
<Label>next row</Label>
</TableViewRow>
</TableView>
</Window>
</Alloy>
index.tss:
".container": {
backgroundColor:"white"
},
"TableView": {
separatorColor: 'transparent'
}
"#row": {
layout: 'vertical'
}
"#staticSection": {
height: 25
}
"#collapsedView": {
height: 50,
backgroundColor: '#dfd'
}
"#expandedView": {
height: 100,
backgroundColor: '#fdd'
}
"#staticRuler": {
width: Ti.UI.FILL,
height: 5,
backgroundColor: '#666'
}
index.js:
$.index.open();
function expand() {
$.expandedView.visible = true;
$.collapsedView.visible = false;
$.row.height = 130;
}
function collapse() {
$.expandedView.visible = false;
$.collapsedView.visible = true;
$.row.height = 80;
}
collapse();
How can I build an expand/collapse View that can be databound to an Alloy Collection and will keep its styling? If ScrollView or some other non-TableView element is better for this (ListView?), can you demonstrate a working example?