Get the App
SLTechnology News&Howtos  ›  Development  › 

Example Analysis of dataTable dynamic header

Shulou Source: shulou.com Published: 2022-06-03 11:01:32 11月15日 Update

This article mainly introduces the example analysis of dataTable dynamic header, which is very detailed and has certain reference value. Friends who are interested must finish it!

The data loaded on the page for the first time can be displayed normally, but the second time the data is obtained through ajax, and the back-end data returns to normal; and the rows in the table are cleared with Datatable.clear (), and the instance generated by Datatable is also destroyed with destroy (); under these two steps, the header of table still exists; at this time, I use $('# example'). Empty () to remove the header structure.

DataTable dynamic header jsp section (here only table other irrelevant):

DataTable dynamic header js section:

/ / datatable header

VardataTable

$(function () {)

/ / query button

$("# searchBtn") .click (function () {

Debugger

Init ()

})

})

Data returned by java backend

Listlist=newArrayList ()

Listlistcolu=newArrayList ()

Mapmap=newHashMap ()

Map.put ("data", list); / / table data

Map.put ("colist", listcolu); / / header column name

Returnmap

Column name entity class: privateStringcolumn_en;// column name corresponds to obj [I] .column _ en

PrivateStringcolumn_cn;// column names correspond to obj [I] .column _ cn

The above is all the content of the article "sample Analysis of dataTable dynamic header". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Tags: Headers data dynamics examples analysis content articles parts Chinese names values interests only background entities instances guys partners buttons more steps Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS Huawei Xiaomi MariaDB OPPO Reno