class Datagrid::Helper::HtmlRow
Represents a datagrid row that provides access to column values for the given asset @example
row = datagrid_row(grid, user) row.class # => Datagrid::Helper::HtmlRow row.first_name # => "<strong>Bogdan</strong>" row.grid # => Datagrid::Base object row.asset # => User object row.each do |value| puts value end
Attributes
Public Class Methods
Source
# File lib/datagrid/helper.rb, line 481 def initialize(renderer, grid, asset, options) @renderer = renderer @grid = grid @asset = asset @options = options end
@!visibility private
Public Instance Methods
Source
# File lib/datagrid/helper.rb, line 495 def each(&block) (@options[:columns] || @grid.html_columns).each do |column| block.call(get(column)) end end
Iterates over all column values that are available in the row param block [Proc] column value iterator
Source
# File lib/datagrid/helper.rb, line 489 def get(column) @renderer.datagrid_value(@grid, column, @asset) end
@return [Object] a column value for given column name
Source
# File lib/datagrid/helper.rb, line 502 def to_s @renderer.send(:_render_partial, "row", options[:partials], { grid: grid, options: options, asset: asset, },) end
@return [String] HTML row format
Protected Instance Methods
Source
# File lib/datagrid/helper.rb, line 512 def method_missing(method, *args, &blk) if (column = @grid.column_by_name(method)) get(column) else super end end
Calls superclass method
Source
# File lib/datagrid/helper.rb, line 520 def respond_to_missing?(method, include_private = false) !!@grid.column_by_name(method) || super end
Calls superclass method