0

I have 2 columns like TPF and TPF_FLAG which i get from my rest service. TPF_FLAG will be 0 or 1 which indicates that should i change the background color of TPF cell or not. If it 1 that TPF cell background should be red. How do i do this?

Hacker
  • 7,798
  • 19
  • 84
  • 154

1 Answers1

1

You can use the renderer on the column like this:

{
      text: 'TD',
      dataIndex: 'TPF',
      renderer: function (value, metaData, record) {
          if(record.get('TPF_FLAG') == 1){
             metaData.tdStyle = 'background-color: red';
          }
          return value;
      }
  }

And note, that the value you return from the renderer will be shown in the column.

Also, you can look at the docs for more things you can do with renderer.

Gašper
  • 815
  • 8
  • 14