PDA

View Full Version : datapath visibility problem


Peter_Chea
03-11-2004, 04:25 PM
Hi, I am having problem turning off the visiblility of the text item when using datapath. In lps 2.1 although I set the visible to false on firstname, it still show up.

<canvas height="80" width="500" >
<dataset name="myData">
<myXML>
<person show="simpsons">
<firstName>Homer</firstName>
<lastName>Simpson</lastName>
</person>
<person show="simpsons">
<firstName>Marge</firstName>
<lastName>Simpson</lastName>
</person>
<person show="simpsons">
<firstName>Montgomery</firstName>
<lastName>Burns</lastName>
</person>
</myXML>
</dataset>

<view name="myTable">
<simplelayout axis="y" />
<view name="rowOfData" datapath="myData:/myXML[1]/person">
<simplelayout axis="x" />
<text visible="false">test 1</text>
<text datapath="firstName/text()" visible="false" />
<text datapath="lastName/text()" />
<text datapath="@show" />
</view>
</view>
</canvas>

vfunshteyn
03-15-2004, 04:09 PM
Use the dataControlsVisibility attribute of datapath. This change fixes the problem:


<text datapath="firstName/text()" visible="false" oninit="this.datapath.setAttribute('dataControlsVisibility ', false)"/>

Peter_Chea
03-15-2004, 05:30 PM
thanks, that works. Do you know why we need to use a second a method to set visibility?

vfunshteyn
03-15-2004, 05:54 PM
Originally posted by Peter_Chea
thanks, that works. Do you know why we need to use a second a method to set visibility?

This is because a node whose datapath matches some data will be visible, by default. The dataControlsVisibility attribute (which you cannot set in the tag, hence this somewhat hackish solution) lets you override the default behavior.

Peter_Chea
03-16-2004, 10:08 AM
thanks

vfunshteyn
03-16-2004, 10:47 AM
This is actually a cleaner way of achieving the same effect:


<text visible="false">
<datapath xpath="firstName/text()">
<attribute name="dataControlsVisibility" value="false"/>
</datapath>
</text>