我是 Rails 新手,使用 jquery 数据库 rails gem 对我的表数据进行排序和搜索。它工作正常,但是当我使用诸如 number_with_delimiter 之类的 rails 辅助方法来显示以逗号分隔的数字时,我没有得到正确的排序结果。
如果不使用 rails helpers,我会得到正确的结果,并且我的表数据排序正确。请问有人可以帮我吗?
这是我的代码:
脚本
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
$('#d3').dataTable({
"sDom": "<'row-fluid'<'span6'l><'span6'f>r>t<'row-fluid'<'span6'i><'span6'p>>",
"sPaginationType": "bootstrap",
aaSorting : [[2, 'desc']],
});
});
</script>
在我的部分表格数据是
<table class="table table-striped table-bordered " id="d3">
<thead>
<tr>
<th>Folder</th>
<th>#Files</th>
<th>Source Lines</th>
<th>Contents</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<td>String data</td>
<td>numeric data</td>
<td>numeric data</td>
<td>string data</td>
<td>string data</td>
</tbody>
</table>
这是我的结果(第三列数据)
SourceLines
994
98
974
.
.
.
101
1,890
1,674