Skip to content

Commit 19372a8

Browse files
committed
example for #1423
1 parent 71041ea commit 19372a8

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

examples/js/advance/edit-type-table.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ function addJobs(quantity) {
3232
jobs.push({
3333
id: id,
3434
name: 'Item name ' + id,
35-
type: 'B',
35+
type1: 'A',
36+
type2: 'B',
3637
active: i % 2 === 0 ? 'Y' : 'N',
3738
datetime: '200' + i + '-12-28T14:57:00'
3839
});
@@ -56,12 +57,21 @@ export default class EditTypeTable extends React.Component {
5657
return `TYPE_${cell}`;
5758
}
5859

60+
jobTypes(row) {
61+
if (row.id > 2) {
62+
return [ 'A', 'B' ];
63+
} else {
64+
return [ 'B', 'C', 'D', 'E' ];
65+
}
66+
}
67+
5968
render() {
6069
return (
6170
<BootstrapTable data={ jobs } cellEdit={ cellEditProp }>
6271
<TableHeaderColumn dataField='id' isKey={ true }>Job ID</TableHeaderColumn>
6372
<TableHeaderColumn dataField='name' editable={ { type: 'textarea' } }>Job Name</TableHeaderColumn>
64-
<TableHeaderColumn dataField='type' dataFormat={ this.formatType } editable={ { type: 'select', options: { values: jobTypes } } }>Job Type</TableHeaderColumn>
73+
<TableHeaderColumn dataField='type1' dataFormat={ this.formatType } editable={ { type: 'select', options: { values: jobTypes } } }>Job Type1</TableHeaderColumn>
74+
<TableHeaderColumn dataField='type2' editable={ { type: 'select', options: { values: this.jobTypes } } }>Job Type2</TableHeaderColumn>
6575
<TableHeaderColumn dataField='active' editable={ { type: 'checkbox', options: { values: 'Y:N' } } }>Active</TableHeaderColumn>
6676
<TableHeaderColumn dataField='datetime' editable={ { type: 'datetime' } }>Date Time</TableHeaderColumn>
6777
</BootstrapTable>

0 commit comments

Comments
 (0)