1
1

More than 1 year has passed since last update.

Thinreportsのlistを使っている時に、ページ毎で表示を切り替えたりしたい

Posted at

問題

Listを使っている場合、add_rowしていってListのdetails部分を増やしていくが、この場合どのタイミングで改ページ(page break)が起きてるのかわからない

解決

list.managerというオブジェクトがどうやらpage_countを持っているので、これをon_page_finalizeでチェックしてデータを操作する。

list.on_page_finalize do
  # page_countは0が1ページ目
  unless list.manager.page_count == 0
    list.header.item(:something).hide # 1ページ目以外では隠すとか
    list.header.value({
      a: 123 # とか
    })
  end
end

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1