File tree 2 files changed +42
-2
lines changed
2 files changed +42
-2
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ var isFun=function(obj){
13
13
class TableBody extends React . Component {
14
14
15
15
constructor ( props ) {
16
- super ( props ) ;
16
+ super ( props ) ;
17
17
this . state = {
18
18
currEditCell : null
19
19
} ;
@@ -189,6 +189,7 @@ class TableBody extends React.Component{
189
189
if ( i == rowIndex - 1 ) {
190
190
key = row [ this . props . keyField ] ;
191
191
selectedRow = row ;
192
+ return false ;
192
193
}
193
194
} , this ) ;
194
195
this . props . onSelectRow ( selectedRow , isSelected ) ;
Original file line number Diff line number Diff line change @@ -4,7 +4,46 @@ import Const from './Const';
4
4
class TableColumn extends React . Component {
5
5
6
6
constructor ( props ) {
7
- super ( props ) ;
7
+ super ( props ) ;
8
+ }
9
+
10
+ shouldComponentUpdate ( nextProps , nextState ) {
11
+ const { children } = this . props ;
12
+ let shouldUpdated = this . props . width !== nextProps . width
13
+ || this . props . className !== nextProps . className
14
+ || this . props . hidden !== nextProps . hidden
15
+ || this . props . dataAlign !== nextProps . dataAlign
16
+ || typeof children !== typeof nextProps . children
17
+ || ( '' + this . props . onEdit ) . toString ( ) !== ( '' + nextProps . onEdit ) . toString ( )
18
+
19
+ if ( shouldUpdated ) {
20
+ return shouldUpdated ;
21
+ }
22
+
23
+ if ( typeof children === 'object' ) {
24
+ if ( children . props . dangerouslySetInnerHTML ) {
25
+ shouldUpdated = shouldUpdated ||
26
+ children . props . dangerouslySetInnerHTML . __html !==
27
+ nextProps . children . props . dangerouslySetInnerHTML . __html ;
28
+ } else if ( children . props . type === 'checkbox' || children . props . type === 'radio' ) {
29
+ shouldUpdated = shouldUpdated ||
30
+ children . props . type !== nextProps . children . props . type ||
31
+ children . props . checked !== nextProps . children . props . checked ;
32
+ }
33
+ } else {
34
+ shouldUpdated = shouldUpdated || children !== nextProps . children ;
35
+ }
36
+
37
+ if ( shouldUpdated ) {
38
+ return shouldUpdated ;
39
+ }
40
+
41
+ if ( ! ( this . props . cellEdit && nextProps . cellEdit ) ) {
42
+ return false ;
43
+ } else {
44
+ return shouldUpdated
45
+ || this . props . cellEdit . mode !== nextProps . cellEdit . mode ;
46
+ }
8
47
}
9
48
10
49
handleCellEdit ( e ) {
You can’t perform that action at this time.
0 commit comments