2
votes

I'm using alloy (markup and models) to construct a tableview, Everything works perfect

<Collection src="spot" />
<Window>
    <TableView id="spotTableView" dataCollection="spot">
        <TableViewRow title="{name}">
            <View class="header-view">
                <Label class="title-header" text="{name}"/>
                <Label class="desc-header" text="{desc}"/>
            </View>
            <View class="fixed-view">
                <ImageView class="image" image="{logo}"/>
                <View class="info-view">
                    <Label class="green-label" text="{cost}"/>
                    <Label text="{minimum}"/>
                </View>
            </View>
        </TableViewRow>
    </TableView>
</Window>

But I have a question: How I can modify dynamic data form for each tableviewrow? I need to change the colors of the labels depending on the data that brings each model in the collection. For example, if the cost is 0 that the label "cost" is green, but if the cost is 100 then the color of the label is red. I guess this must realizarce on the controller, but I would not like create the tableviewrow out of view, because they do not want to miss the advantages of data bindings

1
I was going to take a stab at answering this question, but this person doesn't appear to accept answers when they help them so I lost interest. stackoverflow.com/questions/14533262/…Martin

1 Answers

0
votes

Add a field containing the color to the model, and bind the label's color to it.