-
Notifications
You must be signed in to change notification settings - Fork 552
div based drop down menu in cells (react-select) #379
Comments
I use react-select in cells. import jQuery from 'jquery'
import FixedDataTable from 'fixed-data-table'
import Select from 'react-select'
class ReactSelectCell {
...
onOpen = () => {
jQuery(this.refs.cell).closest('.fixedDataTableRowLayout_rowWrapper').css('z-index', 20);
}
onClose = () => {
jQuery(this.refs.cell).closest('.fixedDataTableRowLayout_rowWrapper').css('z-index', 0);
}
...
render(){
<FixedDataTable.Cell>
<div ref="cell">
<Select
...
onOpen={this.onOpen}
onClose={this.onClose}
/>
</div>
</FixedDataTable.Cell>
}
} Also need modify standard styles ( delete all 'overflow: hidden;'): .fixedDataTableCellGroupLayout_cellGroup {
...
/*overflow: hidden;*/
...
}
.fixedDataTableRowLayout_main {
...
/*overflow: hidden;*/
...
}
.fixedDataTableCellLayout_main {
...
/*overflow: hidden;*/
...
}
.fixedDataTableLayout_rowsContainer {
...
/*overflow: hidden;*/
...
} |
I've noticed that there is an |
I have implemented similar feature using tether-drop and portal api to open dropdown in a particular cell. Please refer this link http://github.hubspot.com/drop/ . |
You can override inline styles with CSS. See https://css-tricks.com/override-inline-styles-with-css/. |
If using React-Select, there is a solution at JedWatson/react-select#810, using the new React 16 Portals. You can probably do something similar with other dropdowns. This way, you don't have to remove the 'overflow-hidden' styles, which causes some issues with the table layout.
|
I am trying extended the FixedDataTable to add some editing features. Simple inputs were really easy. However I got stuck on drop-down type components. It seems that table cells does not work with any type of drop down that is implemented using div, position and z-index.
So i digged a little deeper and found the problem to be with some of the elements setting z-index and overflow:hidden. For the the current version 0.6.0, I am able to operate the drop-down component (react-seldct) iff i do the following in the chrome debugger.
(All of the following it is relative to the cell where the drop-down component is )
The first 2 style are in the .css. Unfortunately the last style in embedded in javascript.
Ideally, we would want to dynamically do the following.
I am really not sure if this can be done without forking the code and i really don't want to fork it for a tiny change like this. I understand that this was suppose to be a view only component however it was written in a way that seemed to be extendable to have editing features. I need some guidance as to how the solution can be approached. Finally thank you for writing the component.
The text was updated successfully, but these errors were encountered: