Documents

rtable

Options

Name Must Data Type Description
cols must Array Column Definition should be a plain object, the key contains:
  • name Column name
  • title Column display value
  • frozen If true, the column will be displayed left pane, default is false
  • align Column text align, the value is: center, left, right
  • width Width of the column, if not given, the width will be automatically calculated to fit the width of grid
  • render Custom render fucntion
  • fixed If true, the column can not be resized by drag and drop
  • sort If this column can be sortable, default is false
data optional Array, DataSet If the data is array, it'll created dataset automatically.
width optional int, string Width of grid, if no provided or `'auto'`, it'll use container's width, default is `undefined`
height optional int, string Height of grid, if no provided, it'll use container's height, default is `undefined`. If `'auto'`, the height of grid will be growed automatically according the number of rows.
maxHeight optional int When height is set to `'auto'`, if maxHeight is set, when real height is great than maxHeight, the height will be always maxHeight
minHeight optional int When height is set to `'auto'`, if minHeight is set, when there are no rows, the height will be always minHeight
container optional string It's element selector. Used for width is `undefined` or `'auto'`, or height is `undefined`.
rowHeight optional int Single row height, default is `34`.
nameField optional string Which value will be used for name of column, default is `'name'`
nameField optional string Which value will be used for title of column, default is `'ttile'`
start optional int Starting index value, it'll be used for index column, default is `0`
indexCol optional boolean Display index column, starting value will be value of `start` option, default is `false`
indexColWidth optional int Width of index column, default is `40`
checkCol optional boolean Display checkbox column, default is `false`
multiSelect optional boolean Multi selection, default is `false`
clickSelect optional boolean If click can select row, default is `'row'`, others are: `'column'`, `null`
remoteSort optional boolean If sort in remote, it'll invoke a callback onSort. Default is `false`
noData optional string If there is no data, show a message, default is `'No Data'`
options optional object Used to set above options easily via plain object

Events

Name Description
onUpdate When DataSet changed, it'll invoke function(dataset, action, changed)
onSort When click sort, it'll invoke function(sort_cols) return new data
onRowClass Return row class

Methods

method could be invoke via:

var grid = document.getElementById('grid')
grid.<method>

You can see just use doc element directly.

Name Description
add Add new records: add(row), row could be an array
remove Remove records: remove(row), row could be an array
update Update records: update(row), row could be an array
get Get records: get(), get(id), get(ids), get(row)
select Select rows: select(row), row could be an array
deselect Deselect rows: deselect(row), row could be an array
is_selected Test is a row is selected: is_selected(row)
get_selected Get selected rows: get_selected()