0

In my React App I use primereact multiselect in which visually I should have 2 sections: The first with the already selected values ​​and the second with all the others (notselected).

I did this by simply adding them to the options array like this:

const newOptions: SelectItem[] = useMemo(() => {
    let updatedOptions: SelectItem[] = [];
    if (selected.length) {
      updatedOptions.push({
        label: 'Selected',
        value: 'selected',
        className: 'q-text-bold ',
      });
      updatedOptions.push(...selected);
    }
    if (notSelected.length) {
      updatedOptions.push({
        label: 'Not Selected',
        value: 'notSelected',
        className: 'q-text-bold',
      });
      updatedOptions.push(...notSelected);
    }
    return updatedOptions;
  }, [selected, notSelected]);

Is there a way to remove the checkboxes from these 2 options, I want them to be seen just as titles? (it's like they separate the two sections, I just couldn't think of another better solution)

Or the even better solution would be if I could do it by selecting a specific one of them, for example: 'notselected' to select all unselected options, but I have no idea how I can do that.

I would be grateful if someone could help me :)

Sarah
  • 1
  • 3

0 Answers0