Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
150
igGrid with cell template - how access parent to change style
posted

Hi,

I'm using igGrid of IgniteUI 2018.

I have a grid where the background color of the the column should switch to red if the text is error. My current soultion is

js file:

...

{ headerText: 'Status' , key: 'TankStatus' , width: "150px", dataType: 'string', dataType: 'string', template: $( "#colTankStatus").html() },

...

html file:

...

<script id="colTankStatus" type="text/template">
  {{if ${TankStatus}.indexOf('Error') >= 0}}
  <div style='background-color: red'>
  {{else}}
  <div style='background-color: transparent'>
  {{/if}}${TankStatus}</div>
</script>

...

This solution will set the background-color of the text div.

Now I want to set the background color of the cell (td) to red but I have no idea how can I access to the (parent) cell element.

Thanks in advance!

  • 150
    Offline posted

    Sorry

    I forgot to write that I'm using

        rowVirtualization: true, 

    and

       virtualrecordsrender: function(evt, ui) { ...

    That might be important

    THX