1

I have an item renderer for a list containing an image, label and a checkbox.

These are visible depending on the dataProvider property of the list.

E.g if an image is a premium image then display the premium label, if an image is a favourite then display a star etc.

The problem is i have a massive if statement, and this doesn't seem good practice.

So how can i seperate the logic from the display components?

Thanks

flexepo
  • 11
  • 1

1 Answers1

1

You don't say what version of Flex you are using. In Flex 4, you could use States and then use includeIn based on the State. If you're using Flex 3, you might want to look at the TileList_withStyle and DataGrid_withStyle at flexdiary.blogspot.com, and do this with styles.

You may also want to look at Robotlegs. I have done this kind of thing in the past by using a Mediator to "watch" the data on a renderer and turn things on and off inside a renderer.

Amy Blankenship
  • 6,485
  • 2
  • 22
  • 45