-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Fix grouping example #1311
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix grouping example #1311
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export const HEADER = 'header'; | ||
export const FILTER = 'filter'; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,30 @@ | ||
import { DragSource } from 'react-dnd'; | ||
import React, {Component} from 'react'; | ||
import React, { Component } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { DragItemTypes } from 'common/constants'; | ||
|
||
class DraggableHeaderCell extends Component { | ||
|
||
componentDidMount() { | ||
let connectDragPreview = this.props.connectDragPreview; | ||
let img = new Image(); | ||
const { connectDragPreview } = this.props; | ||
const img = new Image(); | ||
img.src = './assets/images/drag_column_full.png'; | ||
img.onload = function() { | ||
connectDragPreview(img); | ||
}; | ||
} | ||
|
||
setScrollLeft(scrollLeft) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is no longer required as |
||
if (this.node) { | ||
node.style.webkitTransform = `translate3d(${scrollLeft}px, 0px, 0px)`; | ||
node.style.transform = `translate3d(${scrollLeft}px, 0px, 0px)`; | ||
} | ||
img.onload = () => connectDragPreview(img); | ||
} | ||
|
||
render() { | ||
const { connectDragSource, isDragging} = this.props; | ||
const { connectDragSource, isDragging } = this.props; | ||
if (isDragging) { | ||
return null; | ||
} | ||
return connectDragSource(<div ref={node => this.node = node} style={{cursor: 'move'}}>{this.props.renderHeaderCell(this.props)}</div>); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
return connectDragSource(<div style={{ cursor: 'move' }}>{this.props.children}</div>); | ||
} | ||
} | ||
|
||
DraggableHeaderCell.propTypes = { | ||
connectDragSource: PropTypes.func.isRequired, | ||
connectDragPreview: PropTypes.func.isRequired, | ||
isDragging: PropTypes.bool.isRequired, | ||
renderHeaderCell: PropTypes.func.isRequired | ||
children: PropTypes.element.isRequired | ||
}; | ||
|
||
function collect(connect, monitor) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,11 +10,6 @@ class RowRenderer extends React.Component { | |
renderBaseRow: PropTypes.func.isRequired | ||
}; | ||
|
||
setScrollLeft = (scrollBy) => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not required as we introduced |
||
// if you want freeze columns to work, you need to make sure you implement this as apass through | ||
this.row.setScrollLeft(scrollBy); | ||
}; | ||
|
||
getRowStyle = () => { | ||
return { | ||
color: this.getRowBackground() | ||
|
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added this to show
column.name
instead ofcolumn.key
in the group row