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

[Solved] TreeView client side get item value

6 Answers 230 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.
andrej
Top achievements
Rank 1
andrej asked on 11 Apr 2010, 06:40 PM
I have a treeview

<%= Html.Telerik().TreeView() 
        .Name("SiteMap") 
        .DragAndDrop(settings => settings 
                .DropTargets(".drop-container") 
        ) 
        .ClientEvents(events => events 
            .OnNodeDrop("onNodeDrop") 
        ) 
        .BindTo(Model.Nodes, mappings =>  
        { 
            mappings.For<GotSolution.Cms.Model.SitePage>(binding => binding 
                    .ItemDataBound((item, page) => 
                    { 
                        item.Text = page.MenuName; 
                        item.Value = page.ID.ToString(); 
                    }) 
                    .Children(child => child.ChildPages)); 
             
           mappings.For<GotSolution.Cms.Model.SitePage>(binding => binding 
                    .ItemDataBound((item, page2) => 
                    { 
                        item.Text = page2.MenuName; 
                        item.Value = page2.ID.ToString(); 
                    })); 
        }) 
%> 


Trying to get dropped item value onNodeDrop.
 <script type="text/javascript">
function onNodeDrop(e) { ... }
</script>

I can't see how to achieve that.

$(e.item).text() will return text

$(e.item).value()  does not exist

$(e.item).val() is always empty

Please assist.
 

6 Answers, 1 is accepted

Sort by
0
Accepted
Georgi Krustev
Telerik team
answered on 12 Apr 2010, 11:18 AM
Hi Andrej,

You can use getItemText method to retrieve item text:
var text = getItemText(e.item);

To retrieve item value use getItemValue method:
var value = getItemValue(e.item);

All the best,
Georgi Krustev
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
andrej
Top achievements
Rank 1
answered on 12 Apr 2010, 12:13 PM
Thank you for the answer. I was wandering if there is a list of available functions (full client api reference) for treeview and other mvc controls? I couldn't find it in documentation.
0
Georgi Krustev
Telerik team
answered on 12 Apr 2010, 01:06 PM
Hello Andrej,

Here is a link to the help article devoted on the Client API of the treeview.

Anyway the aforementioned methods were not documented. The update of the documentation will be shipped with the next release of the service pack, scheduled for the middle of the April.

Sincerely yours,
Georgi Krustev
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
Joseph Serrano
Top achievements
Rank 1
answered on 29 Apr 2010, 07:32 AM
Is this fix included in the April 15 release? We couldn't download it and the links are still pointing to the March release
0
Atanas Korchev
Telerik team
answered on 29 Apr 2010, 08:07 AM
Hi Joseph Serrano,

Yes this is included in the April 15 release. However service packs are available only to users with commercial license. Check my blog post for additional info. The SP1 build is available for direct download from this forum thread. This would be more like an exception though - we would post updates only for critical issues.

Regards,
Atanas Korchev
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
Joseph Serrano
Top achievements
Rank 1
answered on 29 Apr 2010, 08:42 AM
That was great! Thanks a lot!
Tags
TreeView
Asked by
andrej
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
andrej
Top achievements
Rank 1
Joseph Serrano
Top achievements
Rank 1
Atanas Korchev
Telerik team
Share this question
or