This is a migrated thread and some comments may be shown as answers.
Unable to deselect treeview check box when using jQuery 1.6.4
1 Answer 18 Views
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Nick
Top achievements
Rank 1
Nick asked on 17 Nov 2011, 12:37 AM
I'm currently using jQuery 1.6.4 and I have a tree view listing the provinces and territories in Canada and the states in the USA, with the two countries being the two top nodes and the provinces & states being child nodes. But I noticed when testing it that I can't deselect any of the check boxes once they've been checked (parent or child). If I remove my reference to jQuery 1.6.4 and let the call to the Telerik Script Registrar import 1.5.1 it seems to work fine. I've removed the layout from my view and eliminated all of my other script files to ensure I wasn't getting an unintended cross over behaviour it still has the same problem. I have been testing in Chrome but the same problem is present in IE9 and Firefox. Am I missing something or is this a bug?

@model IList<Country>
@{
    Layout = "";
    IList<State> states = (IList<State>)ViewData["selectedStates"];
}
 
<script src="@Url.Content("~/Scripts/jquery-1.6.4.min.js")" type="text/javascript"></script>
     
@(Html.Telerik().StyleSheetRegistrar()
    .DefaultGroup(group => group.Add("telerik.common.css")
    .Add("telerik.default.css")))
 
@(Html.Telerik().TreeView()
    .Name("RegionStates")
    .ShowCheckBox(true)
    .ExpandAll(true)
    .BindTo(Model.OrderBy(x=>x.Name), mappings =>
        {
            mappings.For<Country>(binding =>
                    binding.ItemDataBound((node, country) =>
                    {
                        node.Text = country.Name;
                        node.Value = country.CountryId.ToString();
                        node.Checked = country.States.All(x => states.Any(y => y.StateId == x.StateId));
                    })
                    .Children(country => country.States.OrderBy(x => x.Name).ToList()));
            mappings.For<State>(binding => binding.ItemDataBound((node, state) =>
                {
                    node.Text = state.Name;
                    node.Value = state.StateId.ToString();
                    node.Checked = states.Any(x => x.StateId == state.StateId);
                }));
        })
)
 
@Html.Telerik().ScriptRegistrar().jQuery(false)

1 Answer, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 17 Nov 2011, 10:32 AM
Hi Nick,

For proper jQuery 1.6.4 support, please upgrade to the Q3 2011 version of our MVC components.

http://demos.telerik.com/aspnet-mvc/treeview/checkboxsupport

All the best,
Dimo
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 Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now
Tags
TreeView
Asked by
Nick
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Share this question
or