segunda-feira, 28 de janeiro de 2008

Debug furioso

        // (...)
            alert('vai dar pau');
           
            // remove da string que vai para o Form quando há o submit e
            // refaz a pesquisa para recolocar a empresa na pesquisa
            removeTableLine('associateCNPJs',trId);
            alert('ai, carai');
            atualizaString(cnpjAssociado,'cnpjAssociado',true);  
            alert('1');
            cleanTable('cnpjsParaAssociar');   
            alert('2');
            listarPessoaJuridica();
        }
        else if (action == "addSubsortimento")
        {
            // colocar na tabela de associateSubsortimento e
            // tirar da tabela de subsortimentoParaAssociar
            alert("VAI CRIAR: " + id + " " + cnpj + " " + nomeResumido + " " + tipo + " NA TABELA DE BAIXO");
            novaLinha(id,cnpj,nomeResumido,tipo,'associateSubsortimentos');
            alert("DEVE TER CRIADO NA TABELA DE BAIXO");
            alert("VAI REMOVER NA TABELA DE CIMA")
            removeTableLine('subsortimentoParaAssociar',trId);
        }
        else if (action == "delSubsortimento")
        {
            // colocar na tabela de associateSubsortimento e
            // tirar da tabela de subsortimentoParaAssociar
            alert("VAI CRIAR: " + id + " " + cnpj + " " + nomeResumido + " " + tipo + " NA TABELA DE CIMA");
            novaLinha(id,cnpj,nomeResumido,tipo,'subsortimentoParaAssociar');
            alert("DEVE TER CRIADO NA TABELA DE CIMA");
            alert("VAI REMOVER " + trId + "NA TABELA DE BAIXO");
            removeTableLine('associateSubsortimentos',trId);
        }

         //(...)
       function removeTableLine(table,rowId)
       {
           alert('removeTableLine');
           alert('trId: '+rowId);
           var tab1 = document.getElementById(table);
           alert("Removendo da TABEEEELA " + tab1.id);
           var r = document.getElementById(rowId).rowIndex;
           alert("R: " + r + "de " + tab1.rows.length);
           tab1.deleteRow(r);
       }

Tudo isso pra descobrir que o javascript se perde com tableRowId igual em tabelas diferentes.
Mesmo quando a linha anterior seja removida da tabela anterior e inserida em uma outra tabela.

Nenhum comentário:

Postar um comentário