File tree 2 files changed +48
-0
lines changed
2 files changed +48
-0
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import DefaultSelectTable from './default-select-table';
6
6
import SelectBgColorTable from './select-bgcolor-table' ;
7
7
import SelectHookTable from './select-hook-table' ;
8
8
import HideSelectionColumnTable from './hide-selection-col-table' ;
9
+ import RowClickTable from './row-click-table' ;
9
10
10
11
class Demo extends React . Component {
11
12
render ( ) {
@@ -74,6 +75,15 @@ class Demo extends React.Component {
74
75
</ div >
75
76
</ div >
76
77
</ div >
78
+ < div className = "col-md-offset-1 col-md-8" >
79
+ < div className = "panel panel-default" >
80
+ < div className = "panel-heading" > Row Click Example</ div >
81
+ < div className = "panel-body" >
82
+ < h5 > Source in /examples/js/selection/row-click-table.js</ h5 >
83
+ < RowClickTable />
84
+ </ div >
85
+ </ div >
86
+ </ div >
77
87
</ div >
78
88
) ;
79
89
}
Original file line number Diff line number Diff line change
1
+ 'use strict' ;
2
+ import React from 'react' ;
3
+ import { BootstrapTable , TableHeaderColumn } from 'react-bootstrap-table' ;
4
+
5
+
6
+ var products = [ ] ;
7
+
8
+ function addProducts ( quantity ) {
9
+ var startId = products . length ;
10
+ for ( var i = 0 ; i < quantity ; i ++ ) {
11
+ var 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
+ var options = {
23
+ onRowClick : function ( row ) {
24
+ alert ( 'You click row id: ' + row . id ) ;
25
+ }
26
+ } ;
27
+
28
+ export default class SingleSelectTable extends React . Component {
29
+ render ( ) {
30
+ return (
31
+ < BootstrapTable data = { products } options = { options } >
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