Skip navigation
Currently Being Moderated

Spark DataGrid -Dynamically change cell background color

Oct 17, 2011 6:03 AM

I have one column that is a dropdownlist.  When any change is made, I set data.action to 'Update'


protected function cb_changeHandler(event:IndexChangeEvent):void


                                                                                                                                                      data.officeID = cb.selectedItem.ID;


                                                                                                                                                                data.action = 'Update';



I want the other action column background to change based on the new value of data.action


<s:GridColumn   width="70" editable="false" headerText="Action" dataField="action">



<s:DefaultGridItemRenderer background="true"  backgroundColor="{data.action == 'Keep' ? 0x00ff00: data.action == 'Update' ? 0xFFCC00: data.action == 'New' ? 0xffff00: data.action == 'Delete' ? 0xff0000:0x000000}>






Problem is that the data updates, but the color does not.  After scrolling the DataGrid the color does update.  However, I need it to update the color immediately.


Another problem is calling refresh() on the dataProvider does update the colors, but sometimes it causes the wrong row or additional rows to change colors.  Very strange.  There seems to be nothing consistent.  It appears to random change any rows color.


How do the get the grid to redraw the backgroundColor immediately when the dropdown is changed?





More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points