Skip to content

Instantly share code, notes, and snippets.

@t-oginogin
Created April 30, 2014 11:03
Show Gist options
  • Select an option

  • Save t-oginogin/11423899 to your computer and use it in GitHub Desktop.

Select an option

Save t-oginogin/11423899 to your computer and use it in GitHub Desktop.
ThinReportsのリストでページ内にあと何行追加できるか調べたい ref: http://qiita.com/t_oginogin/items/f510d5d2fcd331e0c0ee
module ThinReports
module Core::Shape
class List::Page < Basic::Interface
def rest_row_count
height = manager.current_page_state.height
row_height = manager.current_page_state.format.section_height(:detail)
max_height = manager.page_max_height
row_count = (height / row_height).floor
max_row_count = (max_height / row_height).floor
max_row_count - row_count
end
end
end
end
@tkatsu
Copy link
Copy Markdown

tkatsu commented Jun 6, 2015

これ欲かった機能です。
インストールされた gem の中の page.rb にこの処理を追加したところ動作良好です。
ですがこの方法だと thinkreports のバージョンアップに追随できません。
ローカルの環境にこの処理だけを入れるにはどのようにしたら良いのでしょうか?
いろいろやってみましたが私の知識では解決できませんでした。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment