Method: Wice::GridRenderer#action_column

Defined in:
lib/grid_renderer.rb

#action_column(opts = {}) ⇒ Object

Adds a column with checkboxes for each record. Useful for actions with multiple records, for example, deleting selected records. Please note that action_column only creates the checkboxes and the ‘Select All’ and ‘Deselect All’ buttons, and the form itelf as well as processing the parameters should be taken care of by the application code.

  • :param_name - The name of the HTTP parameter. The complete HTTP parameter is "#{grid_name}[#{param_name}][]". The default param_name is ‘selected’.

  • :td_html_attrs - a hash of HTML attributes to be included into the td tag.

  • :select_all_buttons - show/hide buttons ‘Select All’ and ‘Deselect All’ in the column header. The default is true.

  • :object_property - a method used to obtain the value for the HTTP parameter. The default is id.



150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
# File 'lib/grid_renderer.rb', line 150

def action_column(opts = {})

  if @action_column_present
    raise Wice::WiceGridException.new('There can be only one action column in a WiceGrid')
  end

  options = {
    :param_name     => :selected,
    :td_html_attrs  => {},
    :select_all_buttons => true,
    :object_property => :id
  }

  opts.assert_valid_keys(options.keys)
  options.merge!(opts)
  @action_column_present = true
  @columns << ActionViewColumn.new(@grid, options[:td_html_attrs], options[:param_name],
        options[:select_all_buttons], options[:object_property], @view)
end