Fix Table Title

Asked

Viewed 157 times

0

I have a table that is generated using JSON:

<div id="divResult" ></div>

The script of the JSON:

          $.getJSON("@Url.Content("~/CadLevVisCont/ProcessaLevantamento")", { nmUF: catUF, nmRodovia: catRod, nmAno: catData }, function (data) {
                    $("#divResult").empty();
                    //Adicionar a tabela na div
                    table = "<table id='tableResult' class='table table-striped'><thead><tr><th >UF</th>";
                    table += "<th>BR</th><th >Cod. Levantamento</th><th>Sentido</th><th>km Inicial</th><th>km Final</th><th>Área Quebra de Bordo</th><th>Quantidade de Panelas</th>";
                    table += "<th>Trincamento</th><th>Trincamento Largo</th><th>Desgaste</th><th>IGG</th><th>ICS</th><th>Data do Levantamento</th><th>Obs</th></tr></thead></table>";

                    $("#divResult").append(table);

                    $(eval(data)).each(function (data) {
                        $("#tableResult").append("<tr ><td>"
                            + this.rUF + "</td><td >"
                            + this.rBR + "</td><td >"
                            + this.rCodLev + "</td><td >"
                            + this.rSentido + "</td><td>"
                            + this.rkmIni + "</td><td>"
                            + this.rkmFim + "</td><td>"
                            + this.rAreaQuebraBordo + "</td><td>"                            
                            + this.rQtdPanelas + "</td><td>"
                            + this.rPercet+ "</td><td>"
                            + this.rPercetLargo + "</td><td>"
                            + this.rDesgaste + "</td><td>"
                            + this.rIgg + "</td><td>"
                            + this.rIcs + "</td><td>"
                            + this.rData + "</td><td>"
                            + this.rObs + "</td></tr>");
                    });
                });

How can I make the table title fixed and the data can be viewed through a scroll bar?

  • tries to put the title property in this div, I think it works.

  • When you say title, do you mean the table headers? I mean, the line with the <th>? If so, it is duplicate.

  • I realized that it’s really a duplicate. It’s the same thing I’m wanting to do in the post @Fernando indicated above. Thank you

1 answer

-2

tries to put the title property in this div, I think it works.

example: <div id="divResult" title="algum título"></div>

  • Welcome to Sopt. Here we are different from a forum. Here we provide answers that are correct, that can be proven. Could you elaborate a little more your answer? In the current form your answer can be considered as not useful.

  • Ok Rodrigo, sorry, I was too quick to convert into comment. Complete your reply at will.

  • no problem, it’s the first time I’m commenting, I still need to get used :)

  • Only this is not what the question asks, the idea is to leave a title of a table always fixed, while the body of the table has bearing.

Browser other questions tagged

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