Search code examples
airblackberry-playbook

How do you set the selected item in a qnx.fuse.ui.listClasses.SectionList?


So, when the user clicks on the SectionList, it's easy to get the ICellRenderer selected and change it's state to selected:

this.messagesList.addEventListener(ListEvent.ITEM_CLICKED, messageSelected);    

//Skip some lines...

private function messageSelected(event:ListEvent):void {
    event.cell.state = SkinStates.SELECTED;
}

In my application, I'm saving the child index and the section index of the currently selected item in the list. The problem is that I have no way of accesing the ICellRenderer at that location. Using

this.messagesList.selectedItem = selectedMessage;

doesn't work, either.

Any suggestions? Ideally I would like a function something like

this.messagesList.getCellRendererAt(section:int, child:int)

but I can't find any such methods in the API.


Solution

  • Well, I'm a dummy.

    this.messagesList.selectedItem = foo;
    

    works just fine. Turns out I was doing some other stupid stuff in my code that later cleared the selected item.