Use*_*291 15 html javascript jquery jquery-plugins footable
我正在使用footable我需要在按钮点击时重新加载它但没有将html附加到表中,我需要从sql重新加载它,因为它是第一次填充,是可能的
我试图在div $("#BusList").load(location.href + " #BusList");中加载数据,但设计完全搞砸了
<div class="row" id="BusList">
<table id="demo-foo-filtering" class="table table-striped table-bordered toggle-circle m-b-0" data-page-size="7">
<thead>
<tr>
<th data-toggle="true">Name</th>
<th>Company</th>
<th data-hide="phone">Bus Type</th>
<th data-hide="phone">Bus Model</th>
<th data-hide="phone">Bus Color</th>
<th data-hide="phone, tablet">Driver Status</th>
<th data-hide="phone, tablet">Bus Status</th>
<th data-hide="phone, tablet"></th>
</tr>
</thead>
<tbody>
<%
for (int i = 0; i < BusList.Count; i++)
{ %>
<tr class="gradeX">
<td><%=BusList[i].Name %></td>
<td><%=BusList[i].CompanyName %></td>
<td><%=BusList[i].BusType %></td>
<td><%=BusList[i].BusModel %></td>
<td><%=BusList[i].BusColor %></td>
<td><span class="<%= BusList[i].DriverBusStatus == 1?"label label-table label-success":"label label-table label-inverse"%>"><%=BusList[i].DriverBusStatusDesc %></span></td>
<td><span class="<%= BusList[i].BusStatus == 1?"label label-table label-success":"label label-table label-inverse"%>"><%=BusList[i].BusStatusDesc %></span></td>
<td>
<button type="button" class="btn btn-default" onclick="ViewBus(<%=BusList[i].IdBus %>)" />
View Details</td>
</tr>
<%} %>
</tbody>
<tfoot>
<tr class="active">
<td colspan="10">
<div class="text-right">
<ul class="pagination pagination-split footable-pagination justify-content-end m-t-10 m-b-0"></ul>
</div>
</td>
</tr>
</tfoot>
</table>
</div>
Run Code Online (Sandbox Code Playgroud)
这是加载前的截图
这是加载后的截图
您不会footable在动态加载后重新初始化它。假设刷新后 HTML 结构相同,那么您将需要调用;
$('#demo-foo-filtering').footable();
Run Code Online (Sandbox Code Playgroud)
重新加载 HTML 后。这可能最初是在页面加载时完成的,然后在再次从服务器获取行时将其丢弃。