Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Adobe AIR Development

Posts: 39
Registered: ‎08-02-2012
My Device: Q10
My Carrier: EMT (Estonia)
Accepted Solution

IDataProvider, SectionList and the mysterious "Object"



Maybe I'm missing something in the documentation, but it really bugs me that everywhere we're instructed to use a mysterious Object to provide data to things like SectionList, but the only example we get is

arrMonth.push({label: "January"});

//or sometimes
mySDP.addChildToItem( {label: 'January'}, section );

I would argue this is bad API design practice in general, but I understand it's an easy way to provide arbitrary number of parameters. This however doesn't mean that documentation should neglect what kind of object is needed for SectionList data! What other parameters can it accept? What do they do? And, tangentially, why does

mySectionList.selectedIndex always return -1 no matter what?



Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10
My Carrier: Verizon

Re: IDataProvider, SectionList and the mysterious "Object"

Yes, documentation is lagging. It is best to always have something like:

{ data : 'myuniqueid', label : 'January' } when passing in new items.

Best not to use selectedIndex in a SectionList. Use selectedItem and look at your unique data value to determine which item is selected.