Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languageruby
titleCompute Method
...
	def compute
		...
		return self
	end
...

The compute method will fetch the calculated data you need for your report, but you still have to fill your layout objects for rendering. Each layout has a class defining its structure, and can be filled with your report data by defining a fill method ("fill_#{layout.name}") that follows the layout's cl. which adheres to that structure. 

Code Block
languageruby
titleLayout class defines structure
class Layouts::GroupedTable < Layouts::Base
  attr_accessor :title, :headers, :groups

  def initialize
    self.headers = []
    self.groups = []
    super
  end
end


Code Block
languageruby
titleFill Method in Your Widget's Class
...
	def fill_grouped_table
		my_items =	{
						"Type1" => [ item1, item2],
						"Type2" => [ item3, item4]
					}

		my_items.each do |header, group|
			layout.headers << header
			layout.groups << group
		end		
end

...

	end
...