@@ -32,6 +32,9 @@ export default class Table extends React.Component {
3232 indentSize : PropTypes . number ,
3333 onRowClick : PropTypes . func ,
3434 onRowDoubleClick : PropTypes . func ,
35+ onRowContextMenu : PropTypes . func ,
36+ onRowMouseEnter : PropTypes . func ,
37+ onRowMouseLeave : PropTypes . func ,
3538 expandIconColumnIndex : PropTypes . number ,
3639 showHeader : PropTypes . bool ,
3740 title : PropTypes . func ,
@@ -58,6 +61,7 @@ export default class Table extends React.Component {
5861 onExpandedRowsChange ( ) { } ,
5962 onRowClick ( ) { } ,
6063 onRowDoubleClick ( ) { } ,
64+ onRowContextMenu ( ) { } ,
6165 onRowMouseEnter ( ) { } ,
6266 onRowMouseLeave ( ) { } ,
6367 prefixCls : 'rc-table' ,
@@ -295,7 +299,7 @@ export default class Table extends React.Component {
295299 ) ;
296300 }
297301
298- getRowsByData ( data , visible , indent , columns , fixed ) {
302+ getRowsByData ( originalData , visible , indent , columns , fixed ) {
299303 const props = this . props ;
300304 const {
301305 childrenColumnName,
@@ -308,6 +312,7 @@ export default class Table extends React.Component {
308312 expandedRowStyle,
309313 onRowClick,
310314 onRowDoubleClick,
315+ onRowContextMenu,
311316 onRowMouseEnter,
312317 onRowMouseLeave,
313318 } = props ;
@@ -317,7 +322,10 @@ export default class Table extends React.Component {
317322
318323 const expandIconAsCell = fixed !== 'right' ? props . expandIconAsCell : false ;
319324 const expandIconColumnIndex = fixed !== 'right' ? props . expandIconColumnIndex : - 1 ;
320-
325+ let data = originalData ;
326+ if ( this . columnManager . isAnyColumnsFixed ( ) && data . length === 0 ) {
327+ data = [ { key : 'empty-placeholder-data' } ] ;
328+ }
321329 for ( let i = 0 ; i < data . length ; i ++ ) {
322330 const record = data [ i ] ;
323331 const key = this . getRowKey ( record , i ) ;
@@ -370,6 +378,7 @@ export default class Table extends React.Component {
370378 expandIconColumnIndex = { expandIconColumnIndex }
371379 onRowClick = { onRowClick }
372380 onRowDoubleClick = { onRowDoubleClick }
381+ onRowContextMenu = { onRowContextMenu }
373382 onRowMouseEnter = { onRowMouseEnter }
374383 onRowMouseLeave = { onRowMouseLeave }
375384 height = { height }
@@ -576,11 +585,17 @@ export default class Table extends React.Component {
576585
577586 getEmptyText ( ) {
578587 const { emptyText, prefixCls, data } = this . props ;
579- return ! data . length ? (
580- < div className = { `${ prefixCls } -placeholder` } key = "emptyText" >
588+ if ( data . length ) {
589+ return null ;
590+ }
591+ const fixed = this . columnManager . isAnyColumnsFixed ( ) ;
592+ const emptyClassName =
593+ `${ prefixCls } -placeholder${ fixed ? ` ${ prefixCls } -placeholder-fixed-columns` : '' } ` ;
594+ return (
595+ < div className = { emptyClassName } key = "emptyText" >
581596 { ( typeof emptyText === 'function' ) ? emptyText ( ) : emptyText }
582597 </ div >
583- ) : null ;
598+ ) ;
584599 }
585600
586601 getHeaderRowStyle ( columns , rows ) {
0 commit comments