antd table using computed column


Given we have the following dataset

Id       Username            Role
1         Jeremy                 1
2         Mark                    2

Role 1 or 2 doesn't sounds it means alot. Let's say if Role is 1, then we show 'Admin' otherwise  normal user.


const columns = [{
title: 'Id',
dataIndex: 'Id',
}, {
title: 'Username',
dataIndex: 'username',
}, {
title: 'Role',
dataIndex: 'role',
render: (text, record) => {
if (record.role == 1)
return <span>Admin</span>
else
return <span>Normal user</span>
}
}];




Comments

Popular posts from this blog

The specified initialization vector (IV) does not match the block size for this algorithm