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.
– Rodrigo Alves
When you say title, do you mean the table headers? I mean, the line with the
<th>
? If so, it is duplicate.– bfavaretto
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
– rysahara