First Field is null in Each JQUERY

Asked

Viewed 36 times

0

The first fields are appearing null when I step into the controller follows the code

HTML

 <div id="divItensServicos" class="price-box collapse">
    <h3>Itens de Serviços</h3>
    <div class="container-fluid">
        <div class="row">
            <div class="col-md-3">
                <div class="box">
                </div>
            </div>

            <div class="col-md-9">
                <div>
                    <h4>Valor dos Serviços:  <span1 id="ValorTotalServicos"></span1></h4>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-md-12">

                <table id="grid_Servico" class="table table-bordered table-striped table-hover">
                    <thead>
                        <tr>
                            <th class="invisivel">ID</th>
                            <th>Descrição do Serviço</th>
                            <th>Valor do Serviço</th>
                            <th class="invisivel">Tipo Selecionado</th>
                            <th>Ação</th>
                        </tr>
                    </thead>
                    <br />
                    <tbody>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>

Jquery:

    var ListaOrcamentoServicos = new Array();

$('#grid_Servico tr').not(":first").each(function () {

    ListaOrcamentoServicos.push({
        ID_ItensOrcamentoServico: $(this).find('.id').text(),
        TipoSelecionado: $(this).find('.tipoSelecionado').text(),
        DescricaoServico: $(this).find('.servico').text(),
        ValorServico: $(this).find('.valor').text()
    });

    return ListaOrcamentoServicos;
});

Create line on my grid:

var idServico = 0;

function criar_linhaGridServicos() {

var dados_servico = {
    DescricaoServico: $("#txt_descricaoServico").val(),
    TipoSelecionado: "SE",
    ValorServico: $("#txt_valorServico").val()
};
var somaTotal = 0;
idServico + 1;

$("#divItensServicos").fadeIn(1000);

$("#grid_Servico > tbody").append(
     "<tr class = 'itensServico'>" +
     "    <td class='id invisivel'>" + idServico + "</td>" +
     "    <td class='servico'>" + dados_servico.DescricaoServico + "</td>" +
     "    <td class='valor'>" + dados_servico.ValorServico + "</td>" +
     "    <td class='tipoSelecionado invisivel'>" + dados_servico.TipoSelecionado + "</td>" +
     "    <td <a class='btn btn-danger btn-xs btn-excluir btn-excluirServico' role='button'><i class='glyphicon glyphicon-trash'></i> Excluir</a>" + "</td>" +
     "    <td <a class='btn btn-primary btn-xs btn-alterar btn-alterarServico' role='button'><i class='glyphicon glyphicon-pencil'></i> Alterar</a>" + "</td>" +
     "</tr>"
              );
};

I don’t know if this is the best method of taking the line of a grid to pass to the controller

  • Friend Denilson, put also in question the HTML of the table you want to make the append.

  • You changed the id to grid_Pagamento?

  • I have 3 grids, had put the wrong updated by right.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.