首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >排序在脚表中不起作用

排序在脚表中不起作用
EN

Stack Overflow用户
提问于 2013-08-31 12:28:19
回答 1查看 6.8K关注 0票数 0

我已经在我的应用程序中集成了footable。我已经包括了footable.js,footable.filter.js,footable.paginate.js,footable.sort.js和css文件(footable.core.css和footable.metro.css)。分页和过滤工作得很好,但排序不起作用。

代码语言:javascript
运行
复制
<table class='footable' data-page-navigation=".pagination" data-filter="#filter" data-page-size="10" data-page-previous-text="prev" data-page-next-text="next">
  <thead>
    <tr>
      <th data-sort-initial="true" class='sort-column'>Name</th>
      <th class='sort-column'>Description</th>      
      <th>Actions</th>     
      <th>Manage</th>
    </tr>
  </thead>

  <tbody>
    <% @fee_categories.each do |fee_category| %>
      <tr>
        <td><%= link_to fee_category.name, fee_category %></td>
        <td><%= fee_category.description %></td>
        <td>          
          <%= link_to edit_fee_category_path(fee_category) do %>
            <i class='icon-white icon-pencil btn-primary btn'></i>
          <% end  %>
          <%= link_to fee_category, method: :delete, data: { confirm: 'Are you sure?' } do %>
            <i class='icon-white icon-remove btn-danger btn'></i>
          <% end %>
        </td>
        <td><%= link_to "Add Particulars", "#" %></td>
      </tr>
    <% end %>
  </tbody>
  <tfoot class="hide-if-no-paging">
    <tr>
      <td colspan="5">
        <div class="pagination pagination-centered"></div>
      </td>
    </tr>
  </tfoot>
</table>

而js文件是

代码语言:javascript
运行
复制
$('.footable').footable();
EN

回答 1

Stack Overflow用户

发布于 2013-10-18 00:53:14

我刚刚遇到了类似的问题。我解决这个问题的方法是删除所有额外的选项,直到它开始工作。通过这样做,我能够找到导致问题的原因。在我的例子中,我得到了"data-sort='false'“,这是我没有预料到的。

这对你有效吗:

代码语言:javascript
运行
复制
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <link href="../css/footable.core.css" rel="stylesheet" type="text/css" />
    <script src="../js/jquery-2.0.3.js" type="text/javascript"></script>
    <script src="../js/footable.js" type="text/javascript"></script>
    <script src="../js/footable.sort.js" type="text/javascript"></script>
</head>
<body>
    <table>
        <thead>
            <tr>
                <th data-type="numeric" data-sort-initial="true">Number</th>
                <th>Leter</th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td>2</td>
                <td>B</td>
            </tr>
            <tr>
                <td>3</td>
                <td>C</td>
            </tr>
            <tr>
                <td>1</td>
                <td>A</td>
            </tr>
        </tbody>
    </table>
    <script type="text/javascript">
        $(function () {
            $('table').footable();
        });
    </script>
</body>
</html>

我看到您也在尝试使用分页。也许如果你只专注于排序,然后添加分页,你可能会有更好的运气。

票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/18544479

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档