gpt4 book ai didi

jquery - AdminLTE 数据表未将样式应用于标签

转载 作者:太空宇宙 更新时间:2023-11-04 06:47:12 26 4
gpt4 key购买 nike

所以我正在尝试使用 adminlte 模板创建数据表:

var tblCardHistory;
tblCardHistory = $("#cardhistorynew-table").DataTable({
"deferRender": true,
"paging": true,
"lengthChange": true,
"searching": true,
"ordering": true,
"info": true,
"autoWidth": true,
columns: [
{ data: "emp_id" },
{ data: "name" },
{ data: "card_no" },
{ data: "change_time" },
{ data: "change_date" }
]
});
<link href="//cdn.datatables.net/1.10.19/css/jquery.dataTables.min.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="//cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js"></script>
<div class="box-body">
<div id="cardhistorynew-table_wrapper" class="dataTables_wrapper form-inline dt-bootstrap">
<div class="row">
<div class="col-sm-12">
<table id="cardhistorynew-table" class="table table-bordered table-striped table-hover data-table" role="grid" aria-describedby="cardhistorynew-table_info">
<thead>
<tr role="row">
<th class="sorting_asc" tabindex="0" aria-controls="cardhistorynew-table" rowspan="1" colspan="1">Employee Id</th>
<th class="sorting" tabindex="0" aria-controls="cardhistorynew-table" rowspan="1" colspan="1">Name</th>
<th class="sorting" tabindex="0" aria-controls="cardhistorynew-table" rowspan="1" colspan="1">Card Number</th>
<th class="sorting" tabindex="0" aria-controls="cardhistorynew-table" rowspan="1" colspan="1">Creation Time</th>
<th class="sorting" tabindex="0" aria-controls="cardhistorynew-table" rowspan="1" colspan="1">Creation Date</th>
</tr>
</thead>
<tbody>
<!-- rows -->
</tbody>
</table>
</div>
</div>
</div>
</div>

它正在正确地应用样式。然后我尝试实现搜索、分页等。

除了 search 和 show..entries 标签外,它会正确应用样式:

enter image description here

抱歉,如果我在这里遗漏了一些非常明显的东西。需要帮助;m;

最佳答案

在样式中使用 bootstrap.min.css。寻找代码片段。

var tblCardHistory;
tblCardHistory = $("#cardhistorynew-table").DataTable({
"deferRender": true,
"paging": true,
"lengthChange": true,
"searching": true,
"ordering": true,
"info": true,
"autoWidth": true,
columns: [
{ data: "emp_id" },
{ data: "name" },
{ data: "card_no" },
{ data: "change_time" },
{ data: "change_date" }
]
});
<link href="//cdn.datatables.net/1.10.19/css/jquery.dataTables.min.css" rel="stylesheet"/>

<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">


<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="//cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js"></script>
<div class="box-body">
<div id="cardhistorynew-table_wrapper" class="dataTables_wrapper form-inline dt-bootstrap">
<div class="row">
<div class="col-sm-12">
<table id="cardhistorynew-table" class="table table-bordered table-striped table-hover data-table" role="grid" aria-describedby="cardhistorynew-table_info">
<thead>
<tr role="row">
<th class="sorting_asc" tabindex="0" aria-controls="cardhistorynew-table" rowspan="1" colspan="1">Employee Id</th>
<th class="sorting" tabindex="0" aria-controls="cardhistorynew-table" rowspan="1" colspan="1">Name</th>
<th class="sorting" tabindex="0" aria-controls="cardhistorynew-table" rowspan="1" colspan="1">Card Number</th>
<th class="sorting" tabindex="0" aria-controls="cardhistorynew-table" rowspan="1" colspan="1">Creation Time</th>
<th class="sorting" tabindex="0" aria-controls="cardhistorynew-table" rowspan="1" colspan="1">Creation Date</th>
</tr>
</thead>
<tbody>
<!-- rows -->
<tr>
<th scope="row">1</th>
<td>Mark 1</td>
<td>Otto</td>
<td>@mdo</td>
<td>@twitter 3</td>
</tr>
<tr>
<th scope="row">2</th>
<td>Mark 10</td>
<td>Otto</td>
<td>@mdo</td>
<td>@twitter 3</td>
</tr>
<tr>
<th scope="row">3</th>
<td>Jacob</td>
<td>Thornton</td>
<td>@fat</td>
<td>@twitter 4</td>
</tr>
<tr>
<th scope="row">4</th>
<td>Larry</td>
<td>the Bird</td>
<td>@twitter</td>
<td>@twitter 5</td>
</tr>
<tr>
<th scope="row">5</th>
<td>Mark 5</td>
<td>Otto 5</td>
<td>@mdo 5</td>
<td>@twitter 5</td>
</tr>
<tr>
<th scope="row">6</th>
<td>Mark 6</td>
<td>Otto 6</td>
<td>@mdo 6</td>
<td>@twitter 6</td>
</tr>
<tr>
<th scope="row">7</th>
<td>Mark 7</td>
<td>Otto 7</td>
<td>@mdo 7</td>
<td>@twitter 7</td>
</tr>
<tr>
<th scope="row">8</th>
<td>Mark 8</td>
<td>Otto 8</td>
<td>skb 8</td>
<td>@twitter 8</td>
</tr>
<tr>
<th scope="row">9</th>
<td>Mark 9</td>
<td>Otto 9</td>
<td>@mdo 9</td>
<td>@twitter 9</td>
</tr>
<tr>
<th scope="row">10</th>
<td>Mark 10</td>
<td>Otto 10</td>
<td>@mdo 10</td>
<td>@twitter 10</td>
</tr>
<tr>
<th scope="row">11</th>
<td>Mark 11</td>
<td>Otto 11</td>
<td>@mdo 11</td>
<td>@twitter 11</td>
</tr>
<tr>
<th scope="row">12</th>
<td>Mark 9</td>
<td>Otto 12</td>
<td>@mdo 12</td>
<td>@twitter 12</td>
</tr>

</tbody>
</table>
</div>
</div>
</div>
</div>

关于jquery - AdminLTE 数据表未将样式应用于标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53204126/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com