Click here to Skip to main content
15,891,372 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Mutlti level check is not working properly..

Please see this link & save all contents in html tab as html file and run in browser...

Edit fiddle - JSFiddle[^]

What I have tried:

function OnclickCheckAll(obj) {
            if (obj.checked)
                $("#dvMenuConfigurations :checkbox").prop("checked", "checked");
            else
                $('#dvMenuConfigurations :checkbox').removeAttr('checked');
        }

        function OnclickCheckAllSub(obj) {
		
			obj
            if (obj.checked)
                $("#SubmenuDetails :checkbox").prop("checked", "checked");
            else
                $('#SubmenuDetails :checkbox').removeAttr('checked');
        } 

        function OnclickCheckChild(obj) {
            var parentname = obj.id;
            var Add = parentname.replace('isConfigured', 'isAdd');
            var Mod = parentname.replace('isConfigured', 'isMod');
            var Del = parentname.replace('isConfigured', 'isDel');
            var Bulk = parentname.replace('isConfigured', 'isBulk');

            if (obj.checked) {
                $('#' + Add + '').prop("checked", "checked");
                $('#' + Mod + '').prop("checked", "checked");
                $('#' + Del + '').prop("checked", "checked");
                $('#' + Bulk + '').prop("checked", "checked");
            }
            else {
                $('#' + Add + '').removeAttr('checked');
                $('#' + Mod + '').removeAttr('checked');
                $('#' + Del + '').removeAttr('checked');
                $('#' + Bulk + '').removeAttr('checked');
            }
        }
Posted
Updated 19-Sep-16 4:56am
v7
Comments
Karthik_Mahalingam 19-Sep-16 8:49am    
if you click on header, the relevant child should be checked/unchecked?
Raseeth90 19-Sep-16 9:14am    
yes...
Karthik_Mahalingam 19-Sep-16 10:25am    
ok
ZurdoDev 19-Sep-16 10:39am    
I will not download your code and debug it for you. Perhaps you'll get lucky and someone else will.

What you should do is debug it and see what is happening.

1 solution

check this fiddle - JSFiddle[^]
 
Share this answer
 
Comments
Raseeth90 26-Sep-16 1:19am    
Hi Karthi,
Uncheck is not working properly. If i uncheck all child menu under parent menu(INSTANCE) then parent menu is remains checked but it need to uncheck automatically when corresponding all checkbox is unchecked
Karthik_Mahalingam 26-Sep-16 1:20am    
Hi Raseeth,just now checked the fiddle, it works as per your requirement
Raseeth90 26-Sep-16 1:27am    
Do the following to reproduce the case,

1.Check all menu(MENU Name)
2.Now uncheck all menu submenu(Child Menu) under INSTANCE(Parent Menu)
3.Notice now, The parent Menu(INSTANCE) is checked.
Karthik_Mahalingam 26-Sep-16 1:33am    
This is a new requirement,
post it as a new question and state the complete requirement/issue clearly. if someone has already worked on this kind of task, they might respond quickly.
Raseeth90 26-Sep-16 1:38am    
OK. I posted as different post,

http://www.codeproject.com/Questions/1131807/Jquery-multilevel-check-box-is-not-working-properl

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900