MCPcopy Create free account
hub / github.com/AllenFang/react-bootstrap-table / constructor

Function constructor

src/BootstrapTable.js:23–67  ·  view source on GitHub ↗
(props)

Source from the content-addressed store, hash-verified

21class BootstrapTable extends Component {
22
23 constructor(props) {
24 super(props);
25 this.isIE = false;
26 if (Util.canUseDOM()) {
27 this.isIE = document.documentMode;
28 }
29 this.store = new TableDataStore(this.props.data ? this.props.data.slice() : []);
30 this.isVerticalScroll = false;
31 this.initTable(this.props);
32
33 if (this.props.selectRow && this.props.selectRow.selected) {
34 const copy = this.props.selectRow.selected.slice();
35 this.store.setSelectedRowKey(copy);
36 }
37 let currPage = Const.PAGE_START_INDEX;
38 if (typeof this.props.options.page !== 'undefined') {
39 currPage = this.props.options.page;
40 } else if (typeof this.props.options.pageStartIndex !== 'undefined') {
41 currPage = this.props.options.pageStartIndex;
42 }
43
44 this._adjustHeaderWidth = this._adjustHeaderWidth.bind(this);
45 this._adjustHeight = this._adjustHeight.bind(this);
46 this._adjustTable = this._adjustTable.bind(this);
47 this.toggleExpandAllChilds = this.toggleExpandAllChilds.bind(this);
48
49 let expandedKeys = [];
50 if (this.props.options.expandAllChilds !== null &&
51 this.props.options.expandAllChilds !== undefined && this.props.options.expandAllChilds) {
52 expandedKeys = this.store.getAllRowkey();
53 } else if (this.props.options.expanding !== undefined && this.props.options.expanding !== null) {
54 expandedKeys = this.props.options.expanding;
55 }
56
57 this.state = {
58 data: this.getTableData(),
59 currPage: currPage,
60 expanding: expandedKeys,
61 sizePerPage: this.props.options.sizePerPage || Const.SIZE_PER_PAGE_LIST[0],
62 selectedRowKeys: this.store.getSelectedRowKeys(),
63 reset: false,
64 x: this.props.keyBoardNav ? 0 : -1,
65 y: this.props.keyBoardNav ? 0 : -1
66 };
67 }
68
69 initTable(props) {
70 // If columns changed, clean removed columns that had filters

Callers

nothing calls this directly

Calls 3

setSelectedRowKeyMethod · 0.80
getAllRowkeyMethod · 0.80
getSelectedRowKeysMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…