mardi 20 novembre 2018

How to keep track/count of checked checkboxes in different menu's

I implemented list of checkboxes in different menu's, how to keep count or track of checked checkboxes list. Issue: while changing on different menu's ... Ticked checkboxes again returning as uncheck action. writing code in js. example: Menu's: Speedo(its checkboxes: []x,[]y). Vmax(its checkboxes: []p,[]q,[]r). . .

js code: .

function pageLoad(partName,frameNo){

$.ajax(
        {
            type : "GET",
            url : "TestBench?partName="+partName+"&frameNo="+frameNo,
            cache : false,  
            contentType: "text/plain",
            dataType: 'json',
            success : function(result) 
            {

                defectList = result.Defect_List;
                defectCode = result.Defect_Code;


                $("#testBenchDefects").find('tbody').remove();
                $("#testBenchPart").text(partName);
                for(var i=0; i < defectList.length; i++ ){

                    var row = "<tr class='active'>" +
                    "<td class='text-center' align='left' style='cursor:pointer; background-color:oldlace;' >"
                    +"<b><a style='text-decoration:none; cursor:pointer' >"+ defectList[i]+"</a></b>"

                    +"</td>" 
                    +"<td class='text-center' style='height:40px; width:40px;' align='right'>"  
                    +"<input type='checkbox' id="+defectCode[i]+" value="+defectCode[i]+">" 
                    +"</td>" 
                    +"</tr>";

                    $("#testBenchDefects").append(row);

                }
                $(document).ready(function() { 
                    $('#testBenchDefects tbody tr').click(function(event) { 
                        if (event.target.type !== 'checkbox') {
                            $(':checkbox', this).trigger('click');
                        }
                    });
                });




Aucun commentaire:

Enregistrer un commentaire