extjsextjs5

How to render a font awesome icon when comparing from a value - Ext JS


I have a Grid, and on the grid line I want to render an awesome font icon depending on a condition.

text: UITEXT.GENERAL_STATUS,
dataIndex: 'status',
sortable: false,
flex: 0.5,
align: 'center',
renderer: function (value, record, dataIndex, cell, column) {
    if(value === 1){
        return 'x-fa fa-arrow-circle-up';
    }else if(value === 3){
        return 'x-fa fa-arrow-circle-down';
        }
    }
                                                     .                                                  

Solution

  • I found a way to solve

    text: UITEXT.GENERAL_STATUS,
    dataIndex: 'status',
    sortable: false,
    flex: 0.5,
    align: 'center',
    renderer: function (value, record, dataIndex, cell, column) {
        cell.setTools({
            name: {
                iconCls: value === 1 ? 'x-fa fa-arrow-circle-up' : 'x-fa fa-arrow-circle-down',
            }
        });
    },