const COLUMNS = [
{
title: 'GROUP ID',
dataIndex: 'groupId',
key: 'groupId',
rowKey: 'groupId',
default: true,
sorter: (a, b) => a.groupId - b.groupId,
},
{
title: 'ADMIN ID',
dataIndex: 'adminId',
key: 'adminId',
},
{
title: 'ADMIN NAME',
dataIndex: 'adminName',
key: 'adminName',
sorter: (a, b) => { return a.adminName.localeCompare(b.adminName) },
},
{
title: 'GROUP TYPE',
dataIndex: 'type',
key: 'type',
default: true,
sorter: (a, b) => a.type - b.type,
render: (rowData) => {
return (<div>{rowData === 2 ? 'Resident' : 'Physician'}</div>)
}
},
{
title: 'DIRECTOR NAME',
dataIndex: 'directorName',
key: 'directorName',
},
{
title: 'FAX',
dataIndex: 'fax',
key: 'fax',
},
{
title: 'EMAIL',
dataIndex: 'email',
key: 'email',
default: true
}
]
I am trying to store this array in a redux store,
It is getting saved but with an error on console like,
Uncaught (in promise) DOMException: Failed to execute 'postMessage' on 'BroadcastChannel': function sorter(a, b) {
return a.groupId - b.groupId;
} could not be cloned.
It's getting stored in redux but without the "sorter" and "render" keys.
What I have tried:
what i thought is to convert the "render" and "sorter" key in to a string and using
var fn = window[function_as_string];
i can evaluate.
but problem is that i am using ES6 and i dont wann gave any function name. Please suggest a best approch to do so..
Thank you!!