Link to home
Start Free TrialLog in
Avatar of Steve Jebson
Steve JebsonFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Simulate Treeview Root node click

Hi Experts,

I've found some good posts in EE on capturing some of the events but what i need to do is simulate the click on the root node of my treeview in javascript on the client. I'm hoping this is going to be simple and quick ! I've had a look around the treeview in firebug but can't see anything obvious, not to this beginner anyway ;-)

thanks
Avatar of Pravin Asar
Pravin Asar
Flag of United States of America image

if root node has id assigned, you can get object handle by inquiry

 document.getElementById()

Once you have object, trigger click call


e.g

<html>
<head>
<script type="text/javascript">
function clickRoot()
  {
  document.getElementById('root').click()
  }
function alertMsg()
  {
  alert("Root  was clicked!")
  }
</script>
</head>
<body onload="clickRoot()">
<ul id="root" onclick="alertMsg();">Root
   <li>Section 1
     <ul>
        <li>Test Mode Procedures</li>
         <li>Diagnostic Procedures</li>
        <li>Other Procedures
          <ul>
             <li>Log Analysis</li>
             <li>Error Message Analysis</li>
             <li>Miscellaneous Procedures</li>
               <ul>
                  <li>Emergency Procedures</li>
                  <li>Power-Off Procedures</li>
                </ul>
          </ul>
        </li>
     </ul>
   </li>
   <li>Section 2
     <ul>
        <li>Functional Description
          <ul>
             <li>Power Distribution Function</li>
             <li>System Ready Function</li>
             <li>Emergency Stop Function</li>
          </ul>
        </li>
         <li>Tracking Function</li>
        <li>Other Functions</li>
     </ul>
   </li>  
</ul>
</body>
</html>
By the way , which Javascript /Treeview code you are using ?

Please post some more details.


ASKER CERTIFIED SOLUTION
Avatar of Steve Jebson
Steve Jebson
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial