Overiding the applyData() method should solve your problem:
<text datapath="@isSubscribed">
<method name="applyData" args="data">
if(data=="true")
super.applyData("Subscribed");
else
super.applyData("Not subscribed");
</method>
</text>
M.
James Howe wrote:
I have a text view which is associated with an attribute value from an
XML dataset. The attribute in question has a value of "true" or
"false". I don't want to display "true" or "false", I want to display
another string value based on whether the attribute is true or false.
So far I haven't been able to get my value to display, the text field
always displays 'true' or 'false'. Some partial code that I'm
currently using is:
<gridcolumn text="Status" width="100" resizemargin="1" resizable="false">
<text width="${parent.width}" font="Arial" datapath="@isSubscribed">
<method event="ondata">
if (... == "true") { <--- Not sure what to do here
this.setText("Subscribed");
}
else
this.setText("");
</method>
</datapath>
</text>
</gridcolumn>
The XML looks something like this:
<items>
<item isSubscribed="true"/>
<item isSubscribed="false"/>
...
</items>
The grid to which this gridcolumn belongs has a datapath of "items" and
a contentdatapath of "item". I'm getting the rows I expect, but no
matter what I do, I can't get the text of this column to change. It
always displays as 'true' or 'false.' What am I doing wrong?
Thanks.
_______________________________________________
Laszlo-user mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-user