Jul 13 2004

Flex Lesson Learned: Changing items in a Model bound to a UI Component

Published by Waldo Smeets at 15:51 under Adobe Flex

Note to self and anyone else who is about to make the same mistake; if you have bound a Flex Data Model as DataProvider to a UI component, you must not change any items in that Model by approaching the item directly. The correct way to do so is by approaching the item through the DataProvider API. Otherwise the UI object you have bound to will never know that it needs to redraw (i.e visually represent the changes to your Model).

Don’t: myGrid.getItemAt(itemIndex).myField = 1;
Do: myGrid.dataProvider.editField(itemIndex, “myField”, 1);

One Response to “Flex Lesson Learned: Changing items in a Model bound to a UI Component”

  1. nigon 13 Jul 2004 at 19:42

    Yup, same applies in Flash :)

Trackback URI |