How do I store checked-in Checkboxes values?

1

Hello. I'm making a system that allows access to folders. I look for the folder, which has its id and permissions saved in the database, selecting it, loading its subfolder and checkboxes are loaded to determine the permissions that users will have to them. However, when searching for another folder, this one, previously selected, will disappear from the page. I would like to save the values set in the checkboxes.

Function that assembles the list of permissions folders and checkboxes:

function monta_arvore(a){
          $.each(a.pastasFilhas, function(){
            $("#trazPastas").append("<tr id='pasta"+$(this)[0].id+"'><td id='temFilho"+$(this)[0].id+"'><td style='padding-left:"+$(this)[0][0].margem_esq+"'><input id=checkTds"+$(this)[0].id+" onchange=checarTdsPerm("+$(this)[0].id+") type='checkbox'>"+$(this)[0].id+" "+$(this)[0].nome+"</td></td><td style='left:0'><TD WIDTH='17' ALIGN='CENTER'><input type='checkbox' pastaChecada = "+$(this)[0].id+" id=pasta_ver-"+$(this)[0].id+" class='checarTudo'></TD><TD WIDTH='17' ALIGN='CENTER'><input type='checkbox' pastaChecada = "+$(this)[0].id+" id='pasta_criar-"+$(this)[0].id+"' class='checarTudo'></TD><TD WIDTH='17' ALIGN='CENTER'><input type='checkbox' pastaChecada = "+$(this)[0].id+" id='pasta_excluir-"+$(this)[0].id+"' class='checarTudo'></TD><TD WIDTH='17' ALIGN='CENTER'><input type='checkbox' pastaChecada = "+$(this)[0].id+" id='pasta_renomear-"+$(this)[0].id+"' class='checarTudo'></TD><TD WIDTH='17' ALIGN='CENTER'><input type='checkbox' pastaChecada = "+$(this)[0].id+" id='pasta_mover-"+$(this)[0].id+"' class='checarTudo'></TD><TD WIDTH='17' ALIGN='CENTER'><input type='checkbox' pastaChecada = "+$(this)[0].id+" id='arquivo_criar-"+$(this)[0].id+"' class='checarTudo'></TD><TD WIDTH='17' ALIGN='CENTER'><input type='checkbox' pastaChecada = "+$(this)[0].id+" id='arquivo_excluir-"+$(this)[0].id+"' class='checarTudo'></TD><TD WIDTH='17' ALIGN='CENTER'><input type='checkbox' pastaChecada = "+$(this)[0].id+" id='arquivo_renomear-"+$(this)[0].id+"' class='checarTudo'></TD><TD WIDTH='17' ALIGN='CENTER'><input type='checkbox' pastaChecada = "+$(this)[0].id+" id='arquivo_mover-"+$(this)[0].id+"' class='checarTudo'></TD><td></tr>");
            if($(this)[0].filhos){
              $("#checkTds"+$(this)[0].id).after("<td style='display:inline-block;'><div><a href='javascript:geraFilho("+$(this)[0].id+","+$(this)[0][0].margem_esq+17+")'><img id='mais"+$(this)[0].id+"' src='../imagens/icon-arrow-down-b-16.png' alt='+' height='14px' width='10px'></a></td>");
            }
          });

        }

Function that reads checkboxes:

function testeLeituraPermissões(){
var i=0;
var objetoPermissoesPastas = function(){};

var objPermissoesPastas = new objetoPermissoesPastas();

$.each($(".checarTudo"), function(){
  objPermissoesPastas[$(this)[0].id] = 0
  i++;
});

var permissoes = [];

$.each($(".checarTudo:checked"), function(){
    objPermissoesPastas[$(this)[0].id] = 1;
});
}

I would like to know if you can save, if it can be saved in the session, the folder id and the permissions?

Thank you.

    
asked by anonymous 10.03.2017 / 14:14

0 answers