Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
130
set width or height from javascript?
posted

is it possible to set the width of height of the WebDataTree v.2010.2 through javascript?

Parents
No Data
Reply
  • 4493
    Suggested Answer
    posted

    Hello,

    You need to add handler for the "Initialize" client side event:

     

    1: <ig:WebDataTree runat="server" ID="wdtClient"
    
    2: StyleSetName="RedPlanet" 
    
    
    3: > 
    
    
    4: <ClientEvents Initialize="dtInit" /> 
    
    
    5: <Nodes> 
    
    
    6: <ig:DataTreeNode Text="Root node 1"> 
    
    
    7: <Nodes> 
    
    
    8: <ig:DataTreeNode Text="Sub 1.1" /> 
    
    
    9: <ig:DataTreeNode Text="Sub 1.2" /> 
    
    
    10: <ig:DataTreeNode Text="Sub 1.3"> 
    
    
    11: <Nodes> 
    
    
    12: <ig:DataTreeNode Text="Sub 1.3.1" /> 
    
    
    13: <ig:DataTreeNode Text="Sub 1.3.2" /> 
    
    
    14: </Nodes> 
    
    
    15: </ig:DataTreeNode> 
    
    
    16: </Nodes> 
    
    
    17: </ig:DataTreeNode> 
    
    
    18:
    
    
    19: <ig:DataTreeNode Text="Root 2" /> 
    
    
    20: <ig:DataTreeNode Text="Root 3" /> 
    
    
    21: </Nodes> 
    
    
    22: </ig:WebDataTree> 
    
    
    23:
    
    
    24:
    
    
    

     

    Next you need to define that client side handler function:

        <script type="text/javascript">
            function dtInit(dtObj, e) {
                dtObj.get_element().style.width = '130px';
                dtObj.get_element().style.height = '50px';
            }
        </script>

    Please, let us know if this helped you!

Children