File tree Expand file tree Collapse file tree 2 files changed +16
-4
lines changed
react-bootstrap-table2-example/examples/rows
react-bootstrap-table2/src Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -20,8 +20,8 @@ const columns = [{
2020} ] ;
2121
2222const rowEvents = {
23- onClick : ( e ) => {
24- alert ( 'click on row' ) ;
23+ onClick : ( e , rowIndex ) => {
24+ alert ( `clicked on row with index: ${ rowIndex } ` ) ;
2525 }
2626} ;
2727
@@ -40,8 +40,8 @@ const columns = [{
4040}];
4141
4242const rowEvents = {
43- onClick: (e) => {
44- alert('click on row' );
43+ onClick: (e, rowIndex ) => {
44+ alert(\`clicked on row with index: \${rowIndex}\` );
4545 }
4646};
4747
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ class Row extends Component {
1212 super ( props ) ;
1313 this . clickNum = 0 ;
1414 this . handleRowClick = this . handleRowClick . bind ( this ) ;
15+ this . handleSimpleRowClick = this . handleSimpleRowClick . bind ( this ) ;
1516 }
1617
1718 handleRowClick ( e ) {
@@ -56,6 +57,15 @@ class Row extends Component {
5657 }
5758 }
5859
60+ handleSimpleRowClick ( e ) {
61+ const {
62+ rowIndex,
63+ attrs
64+ } = this . props ;
65+
66+ attrs . onClick ( e , rowIndex ) ;
67+ }
68+
5969 render ( ) {
6070 const {
6171 row,
@@ -89,6 +99,8 @@ class Row extends Component {
8999 const trAttrs = { ...attrs } ;
90100 if ( clickToSelect ) {
91101 trAttrs . onClick = this . handleRowClick ;
102+ } else {
103+ trAttrs . onClick = this . handleSimpleRowClick ;
92104 }
93105
94106 return (
You can’t perform that action at this time.
0 commit comments