Jul 13 2004

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

Published by at 15:51 under Wayback Archive

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 so far

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

  1. nig says:

    Yup, same applies in Flash 🙂