Page 1 of 1

Column Toggle doesn't work if table is editable

Posted: 14 Jul 2020, 05:46
by k41nt
I'm using Primereact Datatable and trying to add column toggle to my table. However, the table is editable and it just doesn't work with column toggle. My guess is that <MultiSelect> has some problem with it, or I might have missed something? I have created a sample code with codesandbox below:
https://codesandbox.io/s/primereact-dat ... -bug-3fxho
Any help would be greatly appreciated!

Re: Column Toggle doesn't work if table is editable

Posted: 11 Oct 2020, 00:13
by mert.sincan
Hi,

Sorry for the delayed response! Please try;

Code: Select all

<MultiSelect
        value={selectedColumns}
        options={columns}
        optionLabel="field"
        dataKey="field"
        onChange={onColumnToggle}
        selectedItemTemplate={(val) => val ? val.field + ' ' : ' '}
        style={{ width: "250px" }}
      />
Best Regards,