[英]Can you recommend good data grid class/gem for Ruby on Rails?
Can you recommend good data grid class/gem for Ruby on Rails? 你能为Ruby on Rails推荐好的数据网格类/ gem吗? Like http://code.google.com/p/zend-framework-datagrid/ for ZF 与ZF的http://code.google.com/p/zend-framework-datagrid/一样
You can also try datagrid gem. 您还可以尝试datagrid gem。 That is focused not only grids with columns but also filters. 这不仅关注具有列的网格,还关注过滤器。
class SimpleReport
include Datagrid
scope do
User.includes(:group)
end
filter(:category, :enum, :select => ["first", "second"])
filter(:disabled, :eboolean)
filter(:confirmed, :boolean)
filter(:group_id, :integer, :multiple => true)
integer_range_filter(:logins_count, :integer)
filter(:group_name, :string, :header => "Group") do |value|
self.joins(:group).where(:groups => {:name => value})
end
column(:name)
column(:group, :order => "groups.name") do |user|
user.name
end
column(:active, :header => "Activated") do |user|
!user.disabled
end
end
不确定这是否是你要找的,但结帐https://github.com/wice/wice_grid
If you are looking for a powerful client-side grid, supporting pagination, sorting, grouping, editing, export to Excel, PDF, etc, you can check Shield UI's Grid component. 如果您正在寻找功能强大的客户端网格,支持分页,排序,分组,编辑,导出到Excel,PDF等,您可以检查Shield UI的网格组件。
Here's a tutorial on how to integrate it in Rails. 这是一个关于如何将它集成到Rails中的教程 。
If you are looking for things like pagination, ordering, sorting etc, then rails does all this automatically. 如果您正在寻找分页,订购,排序等内容,那么rails会自动完成所有这些操作。
So, for example if you wanted to sort all row by a particular column, then the title of that column could simply be a link that sorted the results by that column and then re rendered the grid. 因此,例如,如果您想按特定列对所有行进行排序,那么该列的标题可能只是一个按该列对结果进行排序然后重新呈现网格的链接。
So if you want to build a data grid that isn't AJAXy then this is pretty simple. 因此,如果您想构建一个非AJAXy的数据网格,那么这非常简单。 If you are looking for a way to do it with XHR requests then you can use jQuery to make requests in the background. 如果您正在寻找使用XHR请求的方法,那么您可以使用jQuery在后台发出请求。
As fas as a gem that does all this automatically, I couldn't find one, but I can't see why you couldn't do it yourself easily with the foundations that rails provides. 作为一个自动完成所有这一切的宝石,我找不到一个,但我不明白为什么你不能轻易地用铁轨提供的基础自己做。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.