Once you've received the data for the specific item find the item in the collection and call itemUpdate on it.
var item:MyItem = findItemByID(id, collection); item.extraInformation = results.data; collection.itemUpdated(item); // when you're done you may need to call refresh collection.refresh(); This will cause the data property to be set again in the List. CustomItemrenderer.as, override function set data(item:Object):void { super.data = item; if (item.extraInformation==true) { // show extra information } } You may lose your selected item when you call collection.refresh(). In which case you may need to validate the list and if the selection is not saved then set it back to the selected item. On Thu, Jun 27, 2013 at 6:42 AM, Deepak MS <megharajdee...@gmail.com> wrote: > Hi there, > > > > Just wanted to know if there is a better way to listen for an event in an > itemrenderer. > > > > I’m working on a mobile app, which uses sqlite database and cairngorm > framework. > > > > I have a list in my view which has my CustomRenderer.as as it’s > itemrenderer. This renderer initially loads basic data and displays it(data > is binded which we get in model). > > > > Now, I also have a button on this renderer on clicking of which, I need to > get some more details by querying the db (I avoided this query on initial > load as it degraded the performance) and display this detailed data only on > this renderer on which I click the button. > > > > Currently this is how I am achieving it: > > 1. On click on button in the renderer, I am dispatching a cairngorm > event, which calls a command class, which is where I query db and receive > detailed data. This data is stored in a model variable. > > 2. As soon as I store data in model variable, in next line I am > dispatching this event within same command class : > > FlexGlobals.topLevelApplication.systemManager.dispatchEvent(*new*Event(ApplicationModelLocator.ON_DETAILED_DATA)); > > 3. I have added a listerner in the constructor of > CustomRenderer.as: > > FlexGlobals.topLevelApplication.systemManager.addEventListener(ApplicationModelLocator.OVERVIEW_TREND_CLICK_DATA, > onOverviewTrendClickData, *false*,0,*true*); > > 4. In onOverviewTrendClickData function I build the extra UI that is > needed to show the detailed data. > > > > However, in this approach, the onOverviewTrendClickData function gets > triggered many times(based on number of renderer items that are displayed > in the list). > > > > Can you kindly let me know if there is a way I can avoid it? Or any other > approach to achieve this? > > > > > > Warm regards, > > Deepak >