1 Reply Latest reply on Jul 21, 2009 6:48 AM by Gregory Lafrance

    How to color the text of perticular data grid column with different colors

    aruvasavi

      Hi

       

      Please let me know how to color the Data grid column with different colors depending on the data what we get on other column?

      Let me explain in detail, I have Data grid having alarmName and severityas datagrid columns!

       

       

       

       

       

      Critical,Major,Minor and Warningare the severity levels, depending on these severity levels I need to color tha alarm name text with different colors.

      I am able to color the severity column with different colors but I dont know how to color the alarmName column with different color!

      Data provider to data grid is dynamic and keeps changing!

      Please let me know how to do it

      Find my piece of code as below...

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

      <mx:DataGrid

       

       

      id="alarmDataGrid" dataProvider="{myModel.alarmsList}

      "

      height="

       

      90%" width="98%" x="8" y="19"

      >

       

       

      <mx:columns>

       

       

      <mx:DataGridColumn headerText="PrimeId" dataField="primeId" visible="false"

      />

       

       

      <mx:DataGridColumn id="alarmNameId" headerText="AlarmName" dataField="alarmName"

      />

       

       

      <mx:DataGridColumn id="severityId" itemRenderer="CustomComp" headerText="Severity" dataField="severity"

      />

       

       

      <mx:DataGridColumn headerText="Category" dataField="category"

      />

       

       

      <mx:DataGridColumn headerText="State" dataField="stateId"

      />

       

       

      <mx:DataGridColumn headerText="Source" dataField="source"

      />

       

       

      <mx:DataGridColumn headerText="Received Time" dataField="sourceTime"

      />

       

       

      <mx:DataGridColumn headerText="Update Time" dataField="updateTime" visible="false"

      />

       

       

      <mx:DataGridColumn headerText="cause " dataField="cause"

      />

       

       

      <mx:DataGridColumn headerText="AutomaticAction Taken" dataField="actionName"

      />

       

       

      <mx:DataGridColumn headerText="DownGrade To Event"

      >

       

       

      <mx:itemRenderer>

       

       

      <mx:Component>

       

       

      <mx:Box height="100%" width="30%"

      >

       

       

      <mx:LinkButton id="eventsLinkButtonID" textDecoration="underline

      "

      icon="

       

      @Embed(source='assets/eventsBrowser/X.jpg')

      "

      textAlign="

       

      center" click="outerDocument.onClick();">

       

       

      </mx:LinkButton>

       

       

      </mx:Box>

       

       

      </mx:Component>

       

       

      </mx:itemRenderer>

       

       

      </mx:DataGridColumn>

       

       

      </mx:columns>

       

       

      </mx:DataGrid>

       

       

      Thanks in Advance

      Aruna