作者热门文章
- xml - AJAX/Jquery XML 解析
- 具有多重继承的 XML 模式
- .net - 枚举序列化 Json 与 XML
- XML 简单类型、简单内容、复杂类型、复杂内容
目前表的创建方式如下。目前,最近的事件出现在结果的第 3/4 页。
<div class="row">
<div class="col-md-12">
<% if @events.any? %>
<div class="panel panel-default">
<div class="panel-heading panel-heading-unstyled">
<h3 class="panel-title padding-left">Proshare Admin</h3>
</div>
<div class="panel-body">
<table class="table proshare-table">
<thead>
<tr>
<th>Activity</th>
<th>From</th>
<th>To</th>
<th>Date</th>
<th class="th-last">Time</th>
</tr>
</thead>
<tbody>
<%= render @events %>
</tbody>
</table>
<%= will_paginate @events %>
</div>
</div>
<% end %>
</div>
</div>
最佳答案
分配 @events
时,按 Controller 中最近发生的事件排序。
def index
@events = Event.order(created_at: :desc)
end
关于jquery - 如何在 Rails 中重新排序表格数据,以便最新数据显示在顶部?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36957893/
我是一名优秀的程序员,十分优秀!