This is a migrated thread and some comments may be shown as answers.

Node Click not working in blank space

6 Answers 90 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
mirang
Top achievements
Rank 1
mirang asked on 12 Jan 2012, 09:57 AM
The click event of the node only fires when I click on any text part of the node. If if click on any space after the text the event does not fire. Am I missing anything, any property or any handler?

6 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 12 Jan 2012, 03:26 PM
Hello Mirang,
I have tried reproducing the issue but no avail. Here is the code which fires Node_Click event on clicking the node's space rather than on clicking text.
<telerik:RadTreeView ID="RadTreeView1" runat="server" CheckBoxes="True" Height="280px" OnNodeCheck="RadTreeView1_NodeCheck" onnodeclick="RadTreeView1_NodeClick">
   <Nodes>
      <telerik:RadTreeNode Text="Software" Expanded="true">
         <Nodes>
           <telerik:RadTreeNode Text="Business &amp; Office" />
         </Nodes>
      </telerik:RadTreeNode>
     <telerik:RadTreeNode Text="Books">
         <Nodes>
              <telerik:RadTreeNode Text="Arts &nbsp &nbsp" />
              <telerik:RadTreeNode Text="Biographies" />
         </Nodes>
   </telerik:RadTreeNode>
 </Nodes>
</telerik:RadTreeView>

Thanks,
Princy.
0
mirang
Top achievements
Rank 1
answered on 13 Jan 2012, 04:49 AM
Hi Princy, Thanks for the reply.
Actually I have styled the radtreeview so that the entire node is highlighted, along with the text. By default only the text is highlighted on mouse over so the user can only click on that and it works fine. When I keep the entire node selected and the user click on some other part click does not fire. Any alternatives ?

Thanks
Mirang
0
Bozhidar
Telerik team
answered on 13 Jan 2012, 09:21 AM
Hello Mirang,

You can attach the following function to the TreeVIew's OnClientLoad event:
function clientLoad(sender){
    $telerik.$('.rtTop, .rtMid, .rtBot').bind("click", function(e){
        var treeView = $find("RadTreeView1");
        var node = treeView._extractNodeFromDomElement(e.target);
        node.select();
        //If you want to expand and collapse the node on click, add this as well
        //node.toggle();
    });
}


Regards,
Bozhidar
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
mirang
Top achievements
Rank 1
answered on 13 Jan 2012, 10:25 AM
Thanks Bozhidar,
      That did the trick, but the node.select(); doesnt fire the clientnodeclick event handler attached on the client side? Am I missing anything.

Regards,
Mirang
0
Accepted
Bozhidar
Telerik team
answered on 16 Jan 2012, 10:56 AM
Hello Mirang,

Please excuse me for misunderstanding you.

You can trigger the click with the following code:
Sys.Application.add_load(function () {
             
    $telerik.$('.rtTop, .rtMid, .rtBot').click(function (event) {
        var treeView = $find("RadTreeView1");
        event.eventMapTarget = event.target;
        treeView._click(event);                                   
    });        
 
});

 
Greetings,
Bozhidar
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
mirang
Top achievements
Rank 1
answered on 21 Jan 2012, 12:23 PM
Thanks a lot. That worked perfectly.
Tags
TreeView
Asked by
mirang
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
mirang
Top achievements
Rank 1
Bozhidar
Telerik team
Share this question
or