You need to sign in to do that
Don't have an account?
bretondev
Display various icons in lightning:dataTable
Hello
I want to display different icons in lightning:dataTable based on row condition.
For example
If row1.someField == 'A' then iconName = A
If row2.someField == 'B' then iconName = B
I have looked at documentation but it seems we can specify icons at the colmun level .
This is what I have done so far but it always display the same icon :
I want to display different icons in lightning:dataTable based on row condition.
For example
If row1.someField == 'A' then iconName = A
If row2.someField == 'B' then iconName = B
I have looked at documentation but it seems we can specify icons at the colmun level .
This is what I have done so far but it always display the same icon :
component.set('v.resultColumns', [ {label: 'Provenance', fieldName: 'provenance', cellAttributes: { iconName: 'action:call' }} ]);
You can try declaring your column similar to whats shown below (providing a fieldname to be used in the js controller/helper to set the iconName) and just before you set the list of records which you are going to pass it to datatable's "data" attribute if you try and set the icon based on the rowData you have, you should be able to achieve icon based on condition
Thanks
All Answers
<lightning:icon iconName="utility:error" variant="error"/>
You can try declaring your column similar to whats shown below (providing a fieldname to be used in the js controller/helper to set the iconName) and just before you set the list of records which you are going to pass it to datatable's "data" attribute if you try and set the icon based on the rowData you have, you should be able to achieve icon based on condition
Thanks
run 3 (https://run3az.com)