Need to change the expanded node style

4 posts, 0 answers
  1. Balaji
    Balaji avatar
    30 posts
    Member since:
    Mar 2008

    Posted 08 Dec 2009 Link to this post

    Hi

    We are using ajax rad tree view in our application with custom skin. And there is a requirement to change the expanded node font size & font weight.

    Please suggest me to get the solution

    Thanks in advance,
    Balaji Velasiri
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 08 Dec 2009 Link to this post

    Hallo Balaji Velasiri,

    Try setting the font style from client side as shown below.

    ASPX:
     
    <telerik:RadTreeView ID="RadTreeView1" OnClientNodeCollapsed="OnClientNodeCollapsed" OnClientNodeExpanded="OnClientNodeExpanded" 
        runat="server"
        <Nodes> 
         . . . 
        </Nodes> 
    </telerik:RadTreeView> 

    JavaScript:
     
    <script type="text/javascript"
        function OnClientNodeExpanded(sender, args) { 
            args.get_node().get_textElement().style.fontSize = "20px"// Set the font style 
            args.get_node().get_textElement().style.fontWeight = "bold"// Set the fonf style 
        } 
        function OnClientNodeCollapsed(sender, args) { 
            args.get_node().get_textElement().style.fontSize = "";  // Reset the style 
            args.get_node().get_textElement().style.fontWeight = "normal"// Reset the style 
        } 
    </script> 

    -Shinu.
  3. Balaji
    Balaji avatar
    30 posts
    Member since:
    Mar 2008

    Posted 08 Dec 2009 Link to this post

    Hi Shinu,

    Thanks for your reply.

    And is there any chance to achive the same through tree view custom style sheet ?

    Thanks,
    Balaji Velasiri

  4. Balaji
    Balaji avatar
    30 posts
    Member since:
    Mar 2008

    Posted 16 Dec 2009 Link to this post

    Hi

    I have used the above suggested code. And it is working fine if we expand the node using mouse.

    But I am expanding tree view node from separate button click including the normal node expanding nature(on button click I am calling the script to expand the tree view node e.g: treeView.get_selectedNode().expand()). In this case the OnClientNodeExpanded, OnClientNodeCollapsed events are not firing.

    Is there any way to fire the OnClientNodeExpanded, OnClientNodeCollapsed events even if we expand the tree view node using client side script ?

    Thanks in advance,
    Balaji Velasiri



Back to Top