The following files need to be introduced
<script src= "<%=request.getcontextpath ()%>/static/js/plugins/datatables/datatables.min.js" ></ Script>
I might also need a jquery file, but I've got too many projects to introduce, and if I don't see the table properly, please introduce yourself to other required files.
<table class= ' table table-bordered jambo_table bulk_action table-striped table-hover ' id= ' dat Alist ">//style must be written on <thead> <tr class=" headings "> <th> &nb
sp; <th width= "10%" > Regulatory file name </th> <th width= "10%" > Keyword </th> <th width= "20%" > enacting agency </th> <th width= "10%" > Date of promulgation </th> <th width= "10%" > Document attachments </th> <th width= "10 % > Release status </th> <th width= "10%" > Audit status </th> < Th width= "10%" > Operation </th> <th width= "10%" > function </th> </tr> </th Ead> <tbody>//ajax requested JSON format data padding </tbody> </table>
<thead></thead> tag is DataTables's head,<tbody></tbody> is data, which is populated with Ajax-requested JSON format data, so it's not written.
Next Initialize the DataTable
$ (' #dataList '). DataTable ({"Autowidth": false,//when the table is repeatedly refreshed, my page will appear distorted, the phenomenon, add this is good "serverside": True, "Ajax": {Url:const_url. LIST,//Requested URL method: "POST", data: {//Requested parameter Larename: $ (' #lareName '). Val (), KeyWord: $ (' #keyWord '). Val (), I Ssunitname: $ (' #issUnitName '). Val (), Repstat: $ (' #repStat '). Val (), Veristat: $ (' #veriStat '). Val (), StartDate: $ (' #startDate '). Val (), EndDate: $ (' #endDate '). Val (),},}, "Columndefs": [//Definition of table format (table column starting from 0) {"Ta Rgets ": 0,//This column is an ID, but do not want to display the front end," visible ": false, which means hide" visible ": false,}, targets:8,//according to the style fa-pencil-square, the The 8th column shows the style of an icon render:function (data, Type,row) {return ' <i class= "fa fa-pencil-square text-navy" Guid= "' +row.guid+ '" ></i> ' + ' <i class= "fa fa-trash text-danger fa-lg" guid= "' +row.guid+ '"
Gt;</i> '; {targets:9,//changes the style in column nineth to hyperlink render:function (data, type, row) {return ' <a href= ' > Audit </a> '; }], "columns": [//The returned JSON data is populated here, be sure to correspond to the <th> number above, otherwise typographical distortion {"Data": "Gu ID "}, {" Data ":" Larename "}, {" Data ":" KeyWord "}, {" Data ":" Issunitname "}, {" Data ":" Reletime "} , {"Data": "Laretype"}, {"Data": "Repstat"}, {"Data": "Veristat"}]});