react-bootstrap-table2/docs
Allen 9f92b5368f fix #63 (part1 - cell editing validation)
* implement cell editing validation

* add test cases for cell editing validation

* add story for validator for cell editor

* add docs for cell editor validation
2017-09-23 04:29:37 -05:00
..
columns.md fix #63 (part1 - cell editing validation) 2017-09-23 04:29:37 -05:00
development.md fix #11 2017-08-27 10:55:38 -05:00
README.md fix #63 (part1 - cell editing validation) 2017-09-23 04:29:37 -05:00

Documents

Props on BootstrapTable

Required

Optional

keyField(required) - [String]

keyField is a prop to tell react-bootstrap-table2 which column is unigue key.

data(required) - [Array]

Assign your table data via data prop. It only accept an Array object.

columns(required) - [Object]

columns props accept an Array object, please see columns definition for more detail.

striped - [Bool]

Same as .table-striped class for adding zebra-stripes to a table

bordered - [Bool]

Same as .table-bordered class for adding borders on all sides of the table and cells

hover - [Bool]

Same as .table-hover class for adding a hover effect (grey background color) on table rows

condensed - [Bool]

Same as .table-condensed class for makeing a table more compact by cutting cell padding in half

cellEdit - [Bool]

Assign a valid cellEdit object can enable the cell editing on the cell. The default usage is click/dbclick to trigger cell editing and press ENTER to save cell or press ESC to cancel editing.

Note: The keyField column can't be edited

Following is a cellEdit object:

{
  mode: 'click',
  blurToSave: true,
  timeToCloseMessage: 2500,
  onEditing: (rowId, dataField, newValue) => { ... },
  beforeSaveCell: (oldValue, newValue, row, column) => { ... },
  afterSaveCell: (oldValue, newValue, row, column) => { ... },
  nonEditableRows: () => { ... }
}

cellEdit.mode - [String]

cellEdit.mode possible value is click and dbclick. It's required value that tell react-bootstrap-table2 how to trigger the cell editing.

cellEdit.blurToSave - [Bool]

Default is false, enable it will be able to save the cell automatically when blur from the cell editor.

cellEdit.nonEditableRows - [Function]

cellEdit.nonEditableRows accept a callback function and expect return an array which used to restrict all the columns of some rows as non-editable. So the each item in return array should be rowkey(keyField)

cellEdit.timeToCloseMessage - [Function]

If a column.validator defined and the new value is invalid, react-bootstrap-table2 will popup a alert at the bottom of editor. cellEdit.timeToCloseMessage is a chance to let you decide how long the alert should be stay. Default is 3000 millisecond.