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

[Solved] nodeCheck does not work

5 Answers 195 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.
Stefan
Top achievements
Rank 1
Stefan asked on 29 Sep 2011, 12:44 PM
Hi,

in our application, the following Javascript code works fine:
filterTree.nodeCheck(this, true);


We can check the nodes in our TreeView but we can not uncheck them.
filterTree.nodeCheck(this, false); // does not work


The nodeCheck call is just does nothing. I build a small application to reproduce the problem. The interesting thing is: in the test-application the uncheck works for the first time - but not for any further tries. We have no idea what the problem could be, please let us know if you have any idea.


Thanks in advance.
Stefan

5 Answers, 1 is accepted

Sort by
0
Accepted
Georgi Krustev
Telerik team
answered on 30 Sep 2011, 10:14 AM
Hello Stefan,

 
This is a known issue, which I am glad to inform you will be addressed in the next internal build of Telerik Extensions for ASP.NET MVC, which is available only for customers.

To fix problem manually, you will need to change this method in telerik.treeview.js:

nodeCheck: function (li, isChecked) {
            $(li, this.element).each($.proxy(function (index, item) {
                var $item = $(item).closest('.t-item'),
                    $checkboxHolder = $("> div > .t-checkbox", $item),
                    arrayName = this.element.id + '_checkedNodes',
                    index = $checkboxHolder.find(':input[name="' + arrayName + '.Index"]').val(),
                    checkbox = $checkboxHolder.find(':checkbox');
 
                $checkboxHolder.find(':hidden').filter(function() {
                    // use filter because of nested square brackets
                    return ($(this).attr("name").indexOf(arrayName + '[' + index + '].') > -1);
                }).remove();
                 
                checkbox.attr('value', isChecked ? "True" : "False");
                 
                if (isChecked) {
                    checkbox.attr('checked', 'checked');
                    $($t.treeview.getNodeInputsHtml(this.getItemValue($item), this.getItemText($item), arrayName, index))
                        .appendTo($checkboxHolder);
                } else {
                    checkbox[0].removeAttribute('checked');
                }
            }, this));
        },

with this one:
nodeCheck: function (li, isChecked) {
           $(li, this.element).each($.proxy(function (index, item) {
               var $item = $(item).closest('.t-item'),
                   $checkboxHolder = $("> div > .t-checkbox", $item),
                   arrayName = this.element.id + '_checkedNodes',
                   index = $checkboxHolder.find(':input[name="' + arrayName + '.Index"]').val(),
                   checkbox = $checkboxHolder.find(':checkbox');
 
               $checkboxHolder.find(':hidden').filter(function() {
                   // use filter because of nested square brackets
                   return ($(this).attr("name").indexOf(arrayName + '[' + index + '].') > -1);
               }).remove();
                
               checkbox.attr('value', isChecked ? "True" : "False");
                
               if (isChecked) {
                   checkbox.attr('checked', 'checked');
                   $($t.treeview.getNodeInputsHtml(this.getItemValue($item), this.getItemText($item), arrayName, index))
                       .appendTo($checkboxHolder);
               } else {
                   checkbox.attr('checked', false);
               }
           }, this));
       },


It seems that it is not enough to just remove the "checked" attribute but should also set checked property to false.
Regards,
Georgi Krustev
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
Stefan
Top achievements
Rank 1
answered on 30 Sep 2011, 10:33 AM
Hi Georgi,

Thanks so much, it works perfectly now! Looking forward to the next version.
0
Arava
Top achievements
Rank 1
answered on 03 Nov 2011, 12:19 PM
Hi telerik team,

I still doe not find this fix in 914 version.
Please tell me in which version of teleriks does it work.
or other wise give the telerik.min.js file with this fix.(Iam facing the Same issue as Stefan, but i was misleade that it is Tristae issue.sorry for that)

Please help me out.

Thanks,
Shilpa.





0
Arava
Top achievements
Rank 1
answered on 03 Nov 2011, 12:31 PM

Hi telerik team,

I still does not find this fix in 914 version.
Please tell me in which version of teleriks does it work.
I am facing the Same problem as what stefan is facing.
Kindly sen me the 914 compatibitaly version with this  fix.

Please help me out.

Thanks,
Shilpa.

0
Arava
Top achievements
Rank 1
answered on 03 Nov 2011, 12:42 PM
Hi George,

Could you Please Reply to me ASAP.
Is  the fix avialable in 914 version.

It is important for us.

thanks,
Shilpa
Tags
TreeView
Asked by
Stefan
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Stefan
Top achievements
Rank 1
Arava
Top achievements
Rank 1
Share this question
or