Hiding columns using a condition #91

merged 3 commits into from Mar 6, 2014


None yet
2 participants

iwiznia commented Mar 1, 2014

This is what's discussed in #40. You can specify :if and :unless options for a column to determine if it should be shown or not.

@@ -132,7 +132,7 @@ Datagrid supports different type of filters including:
Each column is represented by name and code block to calculate the value.
``` ruby
-column(:activated, :header => "Active", :order => "activated", :after => :name) do
+column(:activated, :header => "Active", :order => "activated", :after => :name, :if => :show_activated_coumn?, :unless => :hide_activated_coumn?) do

bogdan Mar 2, 2014


Dont think we need this example in Readme. It is too advanced.

@@ -99,6 +101,10 @@ def mandatory?
!! options[:mandatory]
+ def visible?(grid)

bogdan Mar 2, 2014


I would prefer enabled instead of visible because visibility is defined externally to the grid with a different mechanism.


bogdan commented Mar 4, 2014

This one looks good in general. Only two minor comments above and we can merge it.

iwiznia commented Mar 6, 2014


iwiznia commented Mar 6, 2014

Oh... my editor removed all the trailing spaces.... is that a problem?


bogdan commented Mar 6, 2014

Of course it is a problem, trailing spaces are a part of datagrid coding style guide.
Just kidding.

bogdan added a commit that referenced this pull request Mar 6, 2014

Merge pull request #91 from iwiznia/hiding_columns
Hiding columns using a condition

@bogdan bogdan merged commit ac05f41 into bogdan:master Mar 6, 2014

iwiznia commented Mar 6, 2014


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment