Search code examples
apache-flexdatagridflex3itemrenderer

Flex's itemrenderer problem when sorting on datagrid


Please follow my explanation here :

  1. I have a datagrid which holds a dataprovider that has 3 columns
  2. one of those 3 columns is button itemrenderer, others are integer
  3. I put 4 row into the datagrid
  4. I set a button in a row to disable, others are enabled
  5. Then I try sorting the datagrid by "click" on the column header that has integer column (not button column)
  6. The expected result is that the disable button would go with its initial row. But the real result is when you click to sort 2-3 times, the buttons (in all rows) will have a wired behavior. The disabled button sometimes back to enable, and sometimes disabled but stay on a wrong row.

Is there anyone got a solution on this??


Solution

  • ItemRendrer are always reused if the grid has scrollbars and hence resulted into the wierd behavior.

    A good article to read about ItemRenderer life cycle: http://www.adobe.com/devnet/flex/articles/itemrenderers_pt1.html by Peter Ent