def grid(grid, opts = {}, &block)
      raise WiceGridArgumentError.new('Missing block for the grid helper.' \
        ' For detached filters use first define_grid with the same API as grid, ' \
        'then grid_filter to add filters, and then render_grid to actually show the grid') if block.nil?
      define_grid(grid, opts, &block)
      render_grid(grid)
    end
def grid(grid, opts = {}, &block)
      raise WiceGridArgumentError.new('Missing block for the grid helper.' \
        ' For detached filters use first define_grid with the same API as grid, ' \
        'then grid_filter to add filters, and then render_grid to actually show the grid') if block.nil?
      define_grid(grid, opts, &block)
      render_grid(grid)
    end
View helper for rendering the grid.

 The first parameter is a grid object returned by +initialize_grid+ in the controller.

 The second parameter is a hash of options:
 * <tt>:html</tt> - a hash of HTML attributes to be included into the <tt>table</tt> tag.
 * <tt>:class</tt> - a shortcut for <tt>html: {class: 'css_class'}</tt>
 * <tt>:header_tr_html</tt> - a hash of HTML attributes to be included into the first <tt>tr</tt> tag
   (or two first <tt>tr</tt>'s if the filter row is present).
 * <tt>:show_filters</tt> - defines when the filter is shown. Possible values are:
   * <tt>:when_filtered</tt> - the filter is shown when the current table is the result of filtering
   * <tt>:always</tt> or <tt>true</tt>  - show the filter always
   * <tt>:no</tt> or <tt>false</tt>     - never show the filter
 * <tt>:upper_pagination_panel</tt> - a boolean value which defines whether there is an additional pagination
   panel on top of the table. By default it is false.
 * <tt>:extra_request_parameters</tt> - a hash which will be added as additional HTTP request parameters to all
   links generated by the grid, be it sorting links, filters, or the 'Reset Filter' icon.
   Please note that WiceGrid respects and retains all request parameters already present in the URL which
   formed the page, so there is no need to enumerate them in <tt>:extra_request_parameters</tt>. A typical
   usage of <tt>:extra_request_parameters</tt> is a page with javascript tabs - changing the active tab
   does not reload the page, but if one such tab contains a WiceGrid, it could be required that if the user
   orders or filters the grid, the result page should have the tab with the grid activated. For this we
   need to send an additional parameter specifying from which tab the request was generated.
 * <tt>:sorting_dependant_row_cycling</tt> - When set to true (by default it is false) the row styles +odd+
   and +even+ will be changed only when the content of the cell belonging to the sorted column changes.
   In other words, rows with identical values in the ordered column will have the same style (color).
 * <tt>:allow_showing_all_records</tt> - allow or prohibit the "All Records" mode.
 * <tt>:hide_reset_button</tt> - Do not show the default Filter Reset button.
   Useful when using a custom reset button.
   By default it is false.
 * <tt>:hide_submit_button</tt> - Do not show the default Filter Submit button.
   Useful when using a custom submit button
   By default it is false.
 * <tt>:hide_csv_button</tt> - a boolean value which defines whether the default Export To CSV button
   should be rendered. Useful when using a custom Export To CSV button.
   By default it is false.
   Please read README for more insights.

 The block contains definitions of grid columns using the +column+ method sent to the object yielded into
 the block. In other words, the value returned by each of the blocks defines the content of a cell, the
 first block is called for cells of the first column for each row (each ActiveRecord instance), the
 second block is called for cells of the second column, and so on. See the example:

   <%= grid(@accounts_grid, html: {class: 'grid_style', id: 'accounts_grid'}, header_tr_html: {class: 'grid_headers'}) do |g|

     g.column name: 'Username', attribute: 'username' do |account|
       account.username
     end

     g.column name: 'application_account.field.identity_id'._, attribute: 'firstname', model:  Person do |account|
       link_to(account.identity.name, identity_path(account.identity))
     end

     g.column do |account|
       link_to('Edit', edit_account_path(account))
     end

   end -%>


 Defaults for parameters <tt>:show_filters</tt> and <tt>:upper_pagination_panel</tt>
 can be changed in <tt>lib/wice_grid_config.rb</tt> using constants <tt>Wice::Defaults::SHOW_FILTER</tt> and
 <tt>WiceGrid::Defaults::SHOW_UPPER_PAGINATION_PANEL</tt>, this is convenient if you want to set a project wide setting
 without having to repeat it for every grid instance.

 Pease read documentation about the +column+ method to achieve the enlightenment.