1 Reply Latest reply on Feb 29, 2012 6:28 AM by giant2

    rich:tree resize div

    giant2

      Hi!

      I use a rich:tree with its rich:treenode and display the tree into an s:div of size 200x100.

      Using JQuery with the onmouseover I need to enlarge the div to the dimension of the entire tree (so the scrollbars aren't needed).

      I tried with .width, .innerWidth, .outerWidth, but the number returned is 200 everytime.

      onmouseover="alert(jQuery('#xtree\\:mydiv').width())"

      .position() return even the value of 0 and .offset() return everytime 10.6 even if the node on which it's runned is at a deeper position in the tree.

      Someone had the same need?

      rich:tree is powerfull because I can put there the onmouseover call, but in effect I cannot resize the div where it resides.

      The code is:

      <rich:panel .... style="width:200px;">

      <s:div id="mydiv" style="height:100px;width:100%;overflow:auto;">

                          <rich:tree id="treeComponent" value="#{treeBean.rootNode}"

                               onmouseover="alert(jQuery('#xtree\\:mydiv').width())"

                               >

                               <rich:treeNode .....>

                           </rich:tree>

      </s:div>

      </rich:panel>

       

      Some help, please?

        • 1. Re: rich:tree resize div
          giant2

          using jQuery('#xtree\\:mydiv')[0].scrollWidth instead of jQuery('#xtree\\:mydiv').width goes, but there is a strange appening.

          I put my onmouseover in the rich:panel and the onmouseover is called 2 times instead of 1 ... and... when move the mouse directly from one treeitem to other, onmouseover is called!!!

          This appens because the div is not recognized like an entire element, but it is the space where its children aren't (for this reason the browser start out and over few times).

          I solved it using "stop" and "clearQueue" but it seems a jQuery's problem, not richfaces's.