I have created SPFx with React solution. I have used “primereact”: “^9.4.0” version.
I need to set the column width dynamically in the Prime React data-table column.
I have added the same code as below to bind dynamic columns in the Prime React data-table.
columnsArray?.map((col) => {
return (
<Column
key={col?.field}
field={col?.field}
header={col?.header}
style={{ width: col?.width + 'px', whiteSpace: 'nowrap' }}
sortable
filter
filterClear={filterClearTemplate}
filterApply={filterApplyTemplate}
reorderable={true}
body={getAllFieldData}
/>
)
}
})
Everything is working as expected except the width property.
Also, I have tried max-width and min-width properties, and it works as expected.
Can anyone help me with the same?
Thanks
New contributor
Bhoomesh Joshi is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.