Jquery 带分隔符的表格分拣机
我有一个表,它有一个名为Goal的列,该表用ruby填充,如下所示:Jquery 带分隔符的表格分拣机,jquery,ruby-on-rails,sorting,html-table,tablesorter,Jquery,Ruby On Rails,Sorting,Html Table,Tablesorter,我有一个表,它有一个名为Goal的列,该表用ruby填充,如下所示: <table data-sorted="myTable"> <thead> <tr> <th><a rel="tooltip" title="Name">Name</a></th> <th>subname</th> <th>Days</th>
<table data-sorted="myTable">
<thead>
<tr>
<th><a rel="tooltip" title="Name">Name</a></th>
<th>subname</th>
<th>Days</th>
<th>%</th>
<th>Goal</th>
<th>achieved</th>
</tr>
</thead>
<tbody>
<% @results.each do |id, rows| %>
<% rows.each do |row| %>
<tr>
<td>
<b><%= row[:name] %></b></td>
<td><%= row[:subname] %></td>
<td><%= row[:days] %></td>
<td class="<%= status_indicator(row[:percentage].to_f) %>"><%= number_to_percentage(row[:percentage], :precision => 2)%></td>
<td class="{sorter: 'thousands'}"="<%= row[:goal].to_i %>"><%=number_with_delimiter(row[:goal].to_i) %></td>
<td class="achieved"><%= row[:achieved].to_i %></td>
</tr>
<% end %>
<% end %>
</tbody>
</table>
排序在表的所有列中都起作用,但是在那些有1000个分隔符的列上,我得到了这个结果
看起来标题选项将“千”分拣机分配到第7列(从零开始的索引) 其中,元数据将其分配到第5列
<td class="{sorter: 'thousands'}"...
这有用吗?不太可能,问题似乎出在分隔符上,因为没有分隔符,分拣机工作正常。
headers: {
6: {//zero-based column index
sorter:'thousands'
}
}
<td class="{sorter: 'thousands'}"...
headers: {
4: {//zero-based column index
sorter:'thousands'
}
}