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

[Solved] Check child nodes not working

9 Answers 164 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.
Jaymie
Top achievements
Rank 1
Jaymie asked on 07 Dec 2011, 11:26 AM
Hi all,

The other day, I had my childnodes working.
When I selected a parent node, it checked its children and also on postback it was being recorded as checked.

Now, for some reason, the same code I used is not working.
If I uncheck a node, it still displays checked, but if I submit the form it knows it isn't

Here is my code:

function onChecked(e) {
    var treeView = $(this).data("tTreeView");
    var childNodes = $(e.item).find(">.t-group input").filter(":checkbox");
    childNodes.each(function(index, element) {
        treeView.nodeCheck(element, e.checked);
    });
}

9 Answers, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 08 Dec 2011, 01:49 PM
Hello Jaymie,

I see that you are using the same Javascript that I provided a couple of weeks ago. It is still working on my side. Please debug and verify that the problem is not caused by something else. For example you may have updated jQuery (use 1.6.4) or modified something in your application.

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
0
Jaymie
Top achievements
Rank 1
answered on 08 Dec 2011, 02:37 PM
I believe this problem is related to JQuery.
I have done this in my _Layout.cshtml

    @Html.Telerik().ScriptRegistrar().jQuery(false)

and at the top of my page I have

    <script src="@Url.Content("~/Scripts/jquery-1.6.2.min.js")" type="text/javascript"></script>

If I change the script registrar to

    @Html.Telerik().ScriptRegistrar()

The TreeView works as epected, but all other jquery things I have in my project stop working.
But if I use the jQuery(false) then all TreeViews stop working (and I am assuming any other Telerik controls I have in my project).
This is not a good situation, so if you can provide me with a solution where both work, I would appreciate it :)

/Jaymie
0
Jaymie
Top achievements
Rank 1
answered on 08 Dec 2011, 02:56 PM
I think I fixed it.
I have linked to 2 different jquery libraries like so:

    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js" type="text/javascript"></script>

in my head, then in my body, i have used

    @Html.Telerik().ScriptRegistrar().jQuery(false)

And everything appears to be working.
Can you let me know if this is the correct workaround?

/Jaymie
0
Dimo
Telerik team
answered on 08 Dec 2011, 03:23 PM
Hello Jaymie,

You can't have two jQuery instances on the page. In your case only the second one has any effect.

Keep in mind that generally it is best to use our MVC extensions with the jQuery version they have been developed and released with, otherwise we cannot guarantee that everything will work as expected.

Best wishes,
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
0
Jaymie
Top achievements
Rank 1
answered on 08 Dec 2011, 11:44 PM
it appears to be working with both instances.
Using 1.4.4 doesnt work with the tabs i have and other things, but using 1.7.1 doesnt work with telerik, so using both seems to work.
No idea why :)
0
Dimo
Telerik team
answered on 09 Dec 2011, 08:48 AM
Hi Jaymie,

In any case, I don't advise you to use two jQuery instances simultaneously.

Regards,
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
0
Jaymie
Top achievements
Rank 1
answered on 09 Dec 2011, 10:13 AM
that's fine, but I am assuming that your advise would be to upgrade to the latest version of the telerik MVC controls and just use your jquery and keep them up to date?
Other than that, I assume there is no other solution?
0
Dimo
Telerik team
answered on 09 Dec 2011, 10:22 AM
Hi Jaymie,

Generally, our recommendations are:

1. Use the latest version of our MVC extensions in order to benefit from new features and bugfixes.
2. Use our extensions with the jQuery version they have been released with in order to avoid compatibility issues with newer or older jQuery versions, which sometimes break things.

Best wishes,
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
0
Jaymie
Top achievements
Rank 1
answered on 09 Dec 2011, 10:30 AM
yeah, I thought that was the case.
Unfortunately we do not have the budget available to purchase the newer version of the MVC controls and I need the newer jQuery functionality.

So I will have to use my workaround for now, but thanks for your help.

/Jaymie
Tags
TreeView
Asked by
Jaymie
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Jaymie
Top achievements
Rank 1
Share this question
or