Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/395.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/70.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 从sql footable重新加载数据_Javascript_Jquery_Html_Jquery Plugins_Footable - Fatal编程技术网

Javascript 从sql footable重新加载数据

Javascript 从sql footable重新加载数据,javascript,jquery,html,jquery-plugins,footable,Javascript,Jquery,Html,Jquery Plugins,Footable,我正在使用footable,我需要在单击按钮时重新加载它,但不向表中添加html,我需要在第一次填充时从sql重新加载它,这可能吗 我已尝试重新加载div$(“#总线列表”).load(location.href+“#总线列表”)数据已加载,但设计完全混乱 <div class="row" id="BusList"> <table id="demo-foo-filtering" class="table table-striped table-bordered togg

我正在使用footable,我需要在单击按钮时重新加载它,但不向表中添加html,我需要在第一次填充时从sql重新加载它,这可能吗

我已尝试重新加载div
$(“#总线列表”).load(location.href+“#总线列表”)数据已加载,但设计完全混乱

  <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>

名称
单位
公共汽车类型
公共汽车模型
巴士颜色
驾驶员状态
总线状态
查看详细信息
    这是加载前的屏幕截图

    这是加载后的屏幕截图


    动态加载后,您不会重新初始化
    脚踏板。假设刷新后HTML结构相同,则需要调用

    $('#demo-foo-filtering').footable();
    

    在重新加载HTML之后。这可能是在最初的页面加载时完成的,然后在再次从服务器抓取行时将其丢弃。

    据我所知,您的表设计仅依赖于两个元素中的SQL数据,其他元素是静态的:

    <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>
    

    我有一些问题需要确定:首先,您有一个具有良好价值/设计的表,然后您可以对其执行操作,当您单击按钮时,您希望返回到原始表?你如何首先来到这个页面,有好的设计和好的内容?当你点击时,你说你有好的数据,但没有好的设计,我们能看看它是什么样子吗,拜托,因为我们不能尝试自己去做吗?@MickaelLeger我添加了表格的截图。。。请注意,我正在sql中向表中添加数据,因此,单击按钮后,我需要使用来自sql的更新数据刷新表。您是否尝试执行类似操作,因为您的表在第一次加载时很好:1/您创建了一个函数“init_table()”这样做的第一步就是显示具有良好数据的表,并在加载页面时调用它。2/在sql中添加新数据。3/单击后,您将回调“init_table()”并在Ajax上重新加载您的表(您将其擦除,然后像第一次加载一样从scrach中重建,但使用新数据)。在ajax中,您无需重新加载页面即可完成此操作,这样用户就不会看到从
    load()
    调用返回的内容,这似乎与原始HTML结构不匹配。如果是这样,则加载后需要重新初始化
    footable
    ,因为当您删除表并以编程方式重新创建它时,它不会自动重新加载。我尝试了它,但它不起作用。我尝试了此
    $('#demo foo filtering')。数据('footable')。redraw()
    和这个
    $('#demo foo filtering').footable()我甚至尝试加载表而不是div,但我得到的结果是相同的表分页没有加载我也有同样的问题,你找到解决方案了吗?@User7291,我认为,如果您想更进一步,您必须在ajax加载之前/之后提供表代码和完整的
    footable
    初始化调用。我尝试了它,但没有成功,我尝试了这个
    $('#demo foo filtering')。data('footable')。redraw()
    和这个
    $('#demo foo filtering').footable()
    @user7291在提交数据后,您可以向我们显示您的表格html吗?在控制台提交数据后,您是否调用footable?
    $('.table').footable();