File tree Expand file tree Collapse file tree 2 files changed +47
-0
lines changed Expand file tree Collapse file tree 2 files changed +47
-0
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ import DisableClickToNavTable from './disable-click-to-nav-table';
8
8
import NavWithCellEditTable from './nav-with-cell-edit-table' ;
9
9
import CustomStyleNavWithCellEditTable from './custom-style-nav-with-cell-edit-table' ;
10
10
import EnterToEditWithNavTable from './enter-to-edit-with-nav-table' ;
11
+ import EnterToSelectRowWithNavTable from './enter-to-select-row-with-nav-table' ;
11
12
import NavWithExpandingTable from './nav-with-expand-table' ;
12
13
import EnterToExpandWithNavTable from './enter-to-expand-row-with-nav-table' ;
13
14
@@ -71,6 +72,14 @@ class Demo extends React.Component {
71
72
</ span >
72
73
< EnterToEditWithNavTable />
73
74
</ Panel >
75
+ < Panel header = { 'Enter to select row with Keyboard Navigation Example' } >
76
+ { renderLinks ( 'keyboard-nav/enter-to-select-row-with-nav-table' ) }
77
+ < span >
78
+ < code > keyBoardNav</ code > accept a bool or object value< br />
79
+ Use < code > keyBoardNav.enterToSelect</ code > to trigger row selection< br />
80
+ </ span >
81
+ < EnterToSelectRowWithNavTable />
82
+ </ Panel >
74
83
< Panel header = { 'Expand with Keyboard Navigation Example' } >
75
84
{ renderLinks ( 'keyboard-nav/nav-with-expand-table.js' ) }
76
85
< NavWithExpandingTable />
Original file line number Diff line number Diff line change
1
+ /* eslint max-len: 0 */
2
+ import React from 'react' ;
3
+ import { BootstrapTable , TableHeaderColumn } from 'react-bootstrap-table' ;
4
+
5
+
6
+ const products = [ ] ;
7
+
8
+ function addProducts ( quantity ) {
9
+ const startId = products . length ;
10
+ for ( let i = 0 ; i < quantity ; i ++ ) {
11
+ const id = startId + i ;
12
+ products . push ( {
13
+ id : id ,
14
+ name : 'Item name ' + id ,
15
+ price : 2100 + i
16
+ } ) ;
17
+ }
18
+ }
19
+
20
+ addProducts ( 5 ) ;
21
+
22
+ export default class SimpleNavTable extends React . Component {
23
+ render ( ) {
24
+ const selectRow = {
25
+ mode : 'checkbox'
26
+ } ;
27
+ const keyBoardNav = {
28
+ enterToSelect : true
29
+ } ;
30
+ return (
31
+ < BootstrapTable data = { products } selectRow = { selectRow } keyBoardNav = { keyBoardNav } >
32
+ < TableHeaderColumn dataField = 'id' isKey = { true } > Product ID</ TableHeaderColumn >
33
+ < TableHeaderColumn dataField = 'name' > Product Name</ TableHeaderColumn >
34
+ < TableHeaderColumn dataField = 'price' > Product Price</ TableHeaderColumn >
35
+ </ BootstrapTable >
36
+ ) ;
37
+ }
38
+ }
You can’t perform that action at this time.
0 commit comments