Module: BootstrapTableHelper

Extended by:
ActiveSupport::Concern
Includes:
BootstrapHelper
Defined in:
app/helpers/bootstrap_table_helper.rb

Defined Under Namespace

Classes: Row, Table

Instance Method Summary collapse

Methods included from BootstrapHelper

#div, #javascript_include_tag_with_p, #merge_predef_class

Instance Method Details

#table(headers = nil, options = {}, row_options = {}, &block) ⇒ Object

显示标准table headers: 表头,数组[[1, t: ‘xxx’, colspan: 2, class: ‘sss’, 2, t: ‘yyy’, rowspan: 2], [1, t: ‘yyy’, 1, t: ‘zzz’]],

w是宽度,符合bootstrap 12列定义规范,t是表头的名称 ,options是任何th可以接受的options,如果有数组中有多个元素,则显示多个表头行
如果show_seq = false,则加起来为12列,否则加起来11列即可,序号列自动给出

options: Hash

caption: caption of table.
show_seq: true, false default: true
obj: the object to generate table.
cust_row: true, false. Don't use passed object to generate table. default: false
no_page: true, false default: false
fixed: true, false default: true
striped: true, false default: false
bordered: true,false. default: false
condensed: true, false. default: false
check: true, false. Show checkbox on the first column of table instead of seq. default: false
radio: true, false. Show radio button on the first column of table instead of seq. default: false

actions: Array [{js: link, value: xxxx, icon: zzz}, {js: link2, value: yyyy}]

pagi_param_name: 分页参数的名称
pagi_params: 分页附加参数
pagi_method: get, post
pagi_form: must be provided when post


367
368
369
370
371
372
# File 'app/helpers/bootstrap_table_helper.rb', line 367

def table(headers=nil, options={}, row_options={}, &block)
  row_options, options, headers = options, headers, nil if headers.is_a?(Hash)
  table = Table.new(self, headers, options, row_options)
  capture(table, &block)
  table.to_s
end