Hi David,
I took the chance and tried the script you have provided below with
the enabled property. It didn't work.
It works for me, you might want to try again. Here's the code I used to
verify it:
<canvas height="600" width="500">
<dataset name="myData" src="accounts.xml"/>
<simplelayout axis="x" spacing="10"/>
<view>
<simplelayout axis="y" spacing="5"/>
<button text="Enabled Studies Tab">
<handler name="onclick">
studies.tab.setAttribute("visible", true);
</handler>
</button>
<button text="Disable Studies Tab">
<handler name="onclick">
studies.tab.setAttribute("visible", false);
</handler>
</button>
</view>
<tabs x="10">
<tabpane selected="true" >List Of Accounts
<view name="accountsTable">
<simplelayout axis="y" />
<view name="rowOfData" bgcolor="white">
<datapath xpath="myData:/accounts[1]/person"
sortpath="firstName/text()"/>
<method event="onmouseover">
this.setAttribute("bgcolor", blue)
this.setAttribute("fgcolor", white)
</method>
<method event="onmouseout">
this.setAttribute("bgcolor", white)
this.setAttribute("fgcolor", black)
</method>
<simplelayout axis="x" />
<text datapath="firstName/text()" />
<text datapath="lastName/text()" />
<text datapath="@show" />
</view>
</view>
</tabpane>
<tabpane id="studies" visible="false" text="List of Studies">
<handler name="oninit">
this.tab.setAttribute("visible", false);
</handler>
</tabpane>
</tabs>
</canvas>
In anycase, can you point me to the part of the documentation where
these kinds of things are explained.
After reading the Developers and Reference Guides the next best place is
to go to the source.
David
Im trying grid at the moment.
Regards
Richard
David Russell wrote:
Richard,
> Lastly, why the visible false on my last tabname dont work?
It won't work because a tabpane is a composite object, it contains a
tab, the content area etc, so setting its "visible" to false has no
useful effect. You have to apply the change to the tab within the
tabpane.
Try replace
<tabpane visible="false">List Of Studies</tabpane>
with
<tabpane id="studies" visible="false" text="List of Studies">
<handler name="oninit">
this.tab.setAttribute("visible", false);
</handler>
</tabpane>
To show the tab again do this:
studies.tab.setAttribute("visible", true);
As for grids, yes you could use a grid in place of replicating views.
David
Hi David,
Thanks...
Lastly, why the visible false on my last tabname dont work?
Regards
Richard
David Russell wrote:
Richard,
Here is a version of your code with a few small changes. The
onmouse event handlers are defined as part of your rowOfData so can
simply use "this" to refer to the row object, no need for an id
attribute at all. The colors blue and white are themselves objects
and as such are not placed within quotes when used within
setAttribute(). To improve the highlight contrast I've also
adjusted fgcolor which effects font color. Finally, given you are
using blue to highlight a row I changed the initial bgcolor of the
rowOfData to be white.
<canvas height="600" width="500">
<dataset name="myData" src="accounts.xml"/>
<tabs x="10">
<tabpane selected="true" >List Of Accounts
<view name="accountsTable">
<simplelayout axis="y" />
<view name="rowOfData" bgcolor="white">
<datapath xpath="myData:/accounts[1]/person"
sortpath="firstName/text()"/>
<method event="onmouseover">
this.setAttribute("bgcolor", blue)
this.setAttribute("fgcolor", white)
</method>
<method event="onmouseout">
this.setAttribute("bgcolor", white)
this.setAttribute("fgcolor", black)
</method>
<simplelayout axis="x" />
<text datapath="firstName/text()" />
<text datapath="lastName/text()" />
<text datapath="@show" />
</view>
</view>
</tabpane>
<tabpane visible="false">List Of Studies</tabpane>
</tabs>
</canvas>
Regards,
David
Richard Reyes wrote:
Hi Guys,
I hope I can get some help over here...
My test codes below and I can change the background color of the
view. I like to create an effect of highlighting the
the row as the mouse passes by.
current error is null setters on #rowOfData bgcolor
if I remove the id attr i got the error that the rowOfData is
undefined.
Thanks in advance.
Richard
---------------------------
<canvas height="600" width="500">
<dataset name="myData" src="accounts.xml"/>
<tabs x="10">
<tabpane selected="true" >List Of Accounts
<view name="accountsTable">
<simplelayout axis="y" />
<view name="rowOfData" bgcolor="blue" id="rowOfData">
<datapath
xpath="myData:/accounts[1]/person"
sortpath="firstName/text()"
/>
<simplelayout axis="x" />
<text datapath="firstName/text()" />
<text datapath="lastName/text()" />
<text datapath="@show" />
<method event="onmouseover">
rowOfData.setAttribute("bgcolor","blue")
</method>
<method event="onmouseout">
rowOfData.setAttribute("bgcolor","white")
</method>
</view>
</view>
</tabpane>
<tabpane visible="false">List Of Studies</tabpane>
</tabs>
</canvas>