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

[Solved] Tooltip for tree view

11 Answers 289 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Arun Prasath
Top achievements
Rank 1
Arun Prasath asked on 21 May 2010, 07:48 AM
Hi Atanas,
Is it possible to show tooltip for the treeview node on mouse over?
If yes, could you please let us know how we can achieve this?

Many thanks
Arun

11 Answers, 1 is accepted

Sort by
0
Wai Kei
Top achievements
Rank 1
answered on 04 Mar 2011, 04:01 PM
I have a need for this requirement too. Anyone could offer help?

thanks.
0
Atanas Korchev
Telerik team
answered on 07 Mar 2011, 08:15 AM
Hello,

You can  set the title html attribute of the node to get the default browser tooltip:

node.LinkHtmlAttributes(new { title = "some text" });

Regards,
Atanas Korchev
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Wai Kei
Top achievements
Rank 1
answered on 07 Mar 2011, 02:07 PM
Dear Atanas,

  Is it possible to achieve it if I have a server binding treeview? I am trying to fit the LinkHtmlAttributes below but it gives me an error. I also tried item.LinkHtmlAttributes = xxxx, but it's a read-only method.

        Html.Telerik().TreeView()
        .Name("TreeView")
        .ShowCheckBox(true)
        .ExpandAll(Model.Expand)
        .BindTo(Model.CodeTree, mappings =>
        {
            mappings.For<Code>(
                binding => binding.ItemDataBound((item, code) =>
                {
                    item.Checked = false;
                    item.Enabled = true;
                    if (code.CodeId == 0)
                    {
                        item.Checkable = false;
                    }
                    item.Text = code.CodeNumber + " " + code.CodeName;
                    item.Value = code.CodeId.ToString();
                    item.LinkHtmlAttributes(new { title = "some text" });
                })
                .Children(code => code.ChildCodes));

            mappings.For<Code>(binding => binding.ItemDataBound((item, code) => { item.Text = code.CodeName; }));
        })
        .Render();
0
Atanas Korchev
Telerik team
answered on 07 Mar 2011, 02:16 PM
Hello Wai Kei,

 
LinkHtmlAttributes is IDictionary<string, object> so to set a value you should use this syntax:

node.LinkHtmlAttributes["title"] = title;

Regards,
Atanas Korchev
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Wai Kei
Top achievements
Rank 1
answered on 07 Mar 2011, 02:19 PM
That's the solution. Thank you so much.
0
Nick
Top achievements
Rank 1
answered on 18 Mar 2011, 01:01 PM
Is this possible when the tree is bound client side ??
0
Rachael
Top achievements
Rank 1
answered on 08 Apr 2011, 09:06 PM
...
0
Johan Månsson
Top achievements
Rank 1
answered on 28 Jun 2011, 01:20 PM
I'm also wondering this.. It doesn't seem to work if using "Load on demand".
0
Dimo
Telerik team
answered on 28 Jun 2011, 02:42 PM
Hi all,

If the TreeView is bound client-side, you can use the OnDataBound client event and set a title attribute for each span.t-in element inside every li.t-item. The item text is inside the span.

http://www.telerik.com/help/aspnet-mvc/telerik-ui-components-treeview-client-api-and-events.html#OnDataBound

Kind regards,
Dimo
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Johan Månsson
Top achievements
Rank 1
answered on 28 Jun 2011, 02:57 PM
Sure.. but that would mean that I need to duplicate my logic. It's already in C# to add SpriteCssClasses... I'd like to, in the same place, be able to add the title attribute which should work fine with the LinkHtmlAttributes. However, the LinkHtmlAttributes property does not apply to "Load on demand" :(
0
Zain
Top achievements
Rank 1
answered on 02 May 2012, 11:43 AM
Successfull with   "Dimo"   this solution for On demand client side tooltip.
make loop and assign title text to $(e.item).find('span.t-in')[i].title,
following this link to view my case.
http://xien360.blogspot.com/2012/05/telerik-mvc-tree-control-client-side-on.html
Tags
TreeView
Asked by
Arun Prasath
Top achievements
Rank 1
Answers by
Wai Kei
Top achievements
Rank 1
Atanas Korchev
Telerik team
Nick
Top achievements
Rank 1
Rachael
Top achievements
Rank 1
Johan Månsson
Top achievements
Rank 1
Dimo
Telerik team
Zain
Top achievements
Rank 1
Share this question
or