Skip to content

Commit

Permalink
made dropdoiwn select search
Browse files Browse the repository at this point in the history
  • Loading branch information
KelvinTegelaar committed Jul 19, 2024
1 parent 558a8b6 commit 9e51170
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/components/utilities/CippActionsOffcanvas.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import ReactTimeAgo from 'react-time-ago'
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import { faGlobe } from '@fortawesome/free-solid-svg-icons'
import { cellGenericFormatter } from '../tables/CellGenericFormat'
import ReactSelect from 'react-select'

const CippOffcanvasCard = ({ action, key }) => {
const [offcanvasVisible, setOffcanvasVisible] = useState(false)
Expand Down Expand Up @@ -111,11 +112,14 @@ export default function CippActionsOffcanvas(props) {
const handleModal = useCallback(
(modalMessage, modalUrl, modalType = 'GET', modalBody, modalInput, modalDropdown) => {
const handlePostConfirm = () => {
const selectedValue = inputRef.current.value
console.log(inputRef)
const selectedValue = inputRef.current.props?.id
? inputRef.current.props.value.value
: inputRef.current.value
//console.log(inputRef)
let additionalFields = {}

if (inputRef.current.nodeName === 'SELECT') {
if (inputRef.current.props?.id) {
const selectedItem = dropDownInfo.data.find(
(item) => item[modalDropdown.valueField] === selectedValue,
)
Expand Down Expand Up @@ -190,7 +194,10 @@ export default function CippActionsOffcanvas(props) {
{modalDropdown && (
<div>
{dropDownInfo.isSuccess && (
<CFormSelect
<ReactSelect
id="react-select-offcanvas"
classNamePrefix="react-select"
className="react-select-container"
ref={inputRef}
options={dropDownInfo.data.map((data) => ({
value: data[modalDropdown.valueField],
Expand Down

0 comments on commit 9e51170

Please sign in to comment.