You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
I need to show a cell that consists of a dropdown. I've been trying to create it following the pattern of the EditableCell but the value is always undefined for some reason I cannot figure out. Any ideas?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I need to show a cell that consists of a dropdown. I've been trying to create it following the pattern of the EditableCell but the value is always undefined for some reason I cannot figure out. Any ideas?
The custom cell renderer:
const DropDownCell = ({
value: initialValue,
row: { index },
column: { id },
updatePimSelection,
options
}) => {
const [currValue, setCurrValue] = React.useState(initialValue)
const onChange = e => {
setCurrValue(e.target.value.InriverId)
updatePimSelection(index, id, currValue);
}
function getSelectedOption() {
debugger;
let selected = null;
if (options.some(x => x.InriverId === currValue))
selected = options.find(x => x.InriverId === currValue)
return selected;
}
React.useEffect(() => {
setCurrValue(initialValue)
}, [initialValue])
return <Select options={options} getOptionLabel={(option) => option.ItemName} getOptionValue={(option) => option.InriverId}
className="form-control_ form-control-sm_"
isClearable={true}
value={getSelectedOption()}
onChange={onChange}
/>
}
The column definition:
{
id: "Test",
accessor: "Test",
Header: "TEST",
Cell: DropDownCell
},
Beta Was this translation helpful? Give feedback.
All reactions