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>

Reply via email to