Open trig79 opened 3 years ago
@trig79 Your code results in this:
<i className={"'fas fa-check' style={{ color: 'green' }}"}></>
You have too many quotation marks and also your setting style=...
as a class, not an attribute. Instead of using formatExtraData, why don't you just say
formatter: (cell) => {
if (cell === 0) {
props={className: 'fas fa-check', style={color: 'green'}}
} // any other cases
return <i {...prop}></i> }
}
Question Font Awesome Icons are not rendering in Table, am I doing something wrong? I have checked outside the table and they render fine. I am using formatExtraData and have tested rendering RAW text and that works fine, so the issue is just with the Icons themselves, are they supported?
Code
dataField: 'isAdmin', text: 'Adm', formatter: (cell, row, rowIndex, formatExtraData) => { return <i className={formatExtraData[cell]}></i> }, formatExtraData: { 0: "'fas fa-check' style={{ color: 'green' }}", 1: "'fas fa-times' style={{ color: 'red' }}", },