0 Replies Latest reply on Feb 21, 2012 8:01 PM by stevestair

    Tree event order

    stevestair

      I've got a code something like this

      <script>

           var test = "";

           function addTest(val) {

                test += val + ',';

                $('ModelForm:test').innerHTML = test;

          }

      </script>

      <h:form id="ModelForm">

           <rich:tree id="folderTree" value="#{Model.folderTree}"

                var="item" nodeFace="#{item.type}"

                onmousedown="addTest('mousedown')"

                onmouseup="addTest('mouseup')"

                onclick="addTest('click')"

                onselected="addTest('selected')">

                .

                .

                .

           </rich:tree>

           <h:outputText id="test" value="" />

      </h:form>

       

      If I click on an empty area of the tree (not on any node), I get "mousedown,mouseup,click,", as expected.

      If I click on a node, like I was selecting it, I get "click,selected,mousedown,mouseup", which is very much not what I expected.

       

      Why would the click and selected events fire before the mousedown?