def define_grid(grid, opts = {}, &block)
      # strip the method from HTML stuff
      unless grid.class == WiceGrid
        raise WiceGridArgumentError.new('The first argument for the grid helper must be an instance of the WiceGrid class')
      end

      options = {
        allow_showing_all_records:      Defaults::ALLOW_SHOWING_ALL_RECORDS,
        class:                          nil,
        extra_request_parameters:       {},
        header_tr_html:                 {},
        hide_reset_button:              false,
        hide_submit_button:             false,
        hide_csv_button:                false,
        show_filters:                   Defaults::SHOW_FILTER,
        sorting_dependant_row_cycling:  false,
        html:                           {},
        upper_pagination_panel:         Defaults::SHOW_UPPER_PAGINATION_PANEL,
        pagination_theme:               ConfigurationProvider.value_for(:PAGINATION_THEME)
      }

      opts.assert_valid_keys(options.keys)

      options.merge!(opts)

      options[:show_filters] = :no     if options[:show_filters] == false
      options[:show_filters] = :always if options[:show_filters] == true

      rendering = GridRenderer.new(grid, self)

      block.call(rendering) # calling block containing column() calls

      reuse_last_column_for_filter_buttons =
        Defaults::REUSE_LAST_COLUMN_FOR_FILTER_ICONS && rendering.last_column_for_html.capable_of_hosting_filter_related_icons?

      if grid.output_csv?
        grid_csv(grid, rendering)
      else
        # If blank_slate is defined we don't show any grid at all
        if rendering.blank_slate_handler && grid.resultset.size == 0 && !grid.filtering_on?
          generate_blank_slate(grid, rendering)
        else
          grid_html(grid, options, rendering, reuse_last_column_for_filter_buttons)
        end
      end

      grid.view_helper_finished = true

      grid.csv_tempfile ? grid.csv_tempfile.path : nil
    end
def define_grid(grid, opts = {}, &block)
      # strip the method from HTML stuff
      unless grid.class == WiceGrid
        raise WiceGridArgumentError.new('The first argument for the grid helper must be an instance of the WiceGrid class')
      end

      options = {
        allow_showing_all_records:      Defaults::ALLOW_SHOWING_ALL_RECORDS,
        class:                          nil,
        extra_request_parameters:       {},
        header_tr_html:                 {},
        hide_reset_button:              false,
        hide_submit_button:             false,
        hide_csv_button:                false,
        show_filters:                   Defaults::SHOW_FILTER,
        sorting_dependant_row_cycling:  false,
        html:                           {},
        upper_pagination_panel:         Defaults::SHOW_UPPER_PAGINATION_PANEL,
        pagination_theme:               ConfigurationProvider.value_for(:PAGINATION_THEME)
      }

      opts.assert_valid_keys(options.keys)

      options.merge!(opts)

      options[:show_filters] = :no     if options[:show_filters] == false
      options[:show_filters] = :always if options[:show_filters] == true

      rendering = GridRenderer.new(grid, self)

      block.call(rendering) # calling block containing column() calls

      reuse_last_column_for_filter_buttons =
        Defaults::REUSE_LAST_COLUMN_FOR_FILTER_ICONS && rendering.last_column_for_html.capable_of_hosting_filter_related_icons?

      if grid.output_csv?
        grid_csv(grid, rendering)
      else
        # If blank_slate is defined we don't show any grid at all
        if rendering.blank_slate_handler && grid.resultset.size == 0 && !grid.filtering_on?
          generate_blank_slate(grid, rendering)
        else
          grid_html(grid, options, rendering, reuse_last_column_for_filter_buttons)
        end
      end

      grid.view_helper_finished = true

      grid.csv_tempfile ? grid.csv_tempfile.path : nil
    end
Has the same parameters as <tt>grid</tt> but does not output the grid. After <tt>define_grid</tt>
 <tt>render_grid</tt> can be used to output the grid HTML code.
 Usually used with detached filters: first <tt>define_grid</tt>, then <tt>grid_filter</tt>s, and then
 <tt>render_grid</tt>