@@ -98,6 +98,12 @@ const Cell = React.createClass({
98
98
}
99
99
} ,
100
100
101
+ onCellKeyDown ( e ) {
102
+ if ( this . canExpand ( ) && e . key === 'Enter' ) {
103
+ this . onCellExpand ( e ) ;
104
+ }
105
+ } ,
106
+
101
107
onDragHandleDoubleClick ( e ) {
102
108
e . stopPropagation ( ) ;
103
109
let meta = this . props . cellMetaData ;
@@ -120,7 +126,7 @@ const Cell = React.createClass({
120
126
return style ;
121
127
} ,
122
128
123
- getFormatter ( ) : ? ReactElement {
129
+ getFormatter ( ) {
124
130
let col = this . props . column ;
125
131
if ( this . isActive ( ) ) {
126
132
return < EditorContainer rowData = { this . getRowData ( ) } rowIdx = { this . props . rowIdx } idx = { this . props . idx } cellMetaData = { this . props . cellMetaData } column = { col } height = { this . props . height } /> ;
@@ -327,6 +333,10 @@ const Cell = React.createClass({
327
333
return ( this . props . column . editor != null ) || this . props . column . editable ;
328
334
} ,
329
335
336
+ canExpand ( ) {
337
+ return this . props . expandableOptions && this . props . expandableOptions . canExpand ;
338
+ } ,
339
+
330
340
renderCellContent ( props ) {
331
341
let CellContent ;
332
342
let Formatter = this . getFormatter ( ) ;
@@ -341,8 +351,8 @@ const Cell = React.createClass({
341
351
let cellExpander ;
342
352
let marginLeft = this . props . expandableOptions ? ( this . props . expandableOptions . treeDepth * 30 ) : 0 ;
343
353
let marginLeftCell = this . props . expandableOptions ? ( this . props . expandableOptions . treeDepth * 10 ) : 0 ;
344
- if ( this . props . expandableOptions && this . props . expandableOptions . canExpand ) {
345
- cellExpander = ( < span style = { { float : 'left' , marginLeft : marginLeft } } onClick = { this . onCellExpand } > { this . props . expandableOptions . expanded ? String . fromCharCode ( '9660' ) : String . fromCharCode ( '9658' ) } </ span > ) ;
354
+ if ( this . canExpand ( ) ) {
355
+ cellExpander = ( < span style = { { float : 'left' , marginLeft : marginLeft } } onClick = { this . onCellExpand } > { this . props . expandableOptions . expanded ? String . fromCharCode ( '9660' ) : String . fromCharCode ( '9658' ) } </ span > ) ;
346
356
}
347
357
return ( < div ref = "cell"
348
358
className = "react-grid-Cell__value" > { cellExpander } < span style = { { float : 'left' , marginLeft : marginLeftCell } } > { CellContent } </ span > { this . props . cellControls } </ div > ) ;
@@ -363,7 +373,7 @@ const Cell = React.createClass({
363
373
let dragHandle = ( ! this . isActive ( ) && this . canEdit ( ) ) ? < div className = "drag-handle" draggable = "true" onDoubleClick = { this . onDragHandleDoubleClick } > < span style = { { display : 'none' } } > </ span > </ div > : null ;
364
374
365
375
return (
366
- < div { ...this . props } className = { className } style = { style } onClick = { this . onCellClick } onDoubleClick = { this . onCellDoubleClick } onDragOver = { this . onDragOver } >
376
+ < div { ...this . props } className = { className } style = { style } onKeyDown = { this . onCellKeyDown } onClick = { this . onCellClick } onDoubleClick = { this . onCellDoubleClick } onDragOver = { this . onDragOver } >
367
377
{ cellContent }
368
378
{ dragHandle }
369
379
</ div >
0 commit comments