Welcome!

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

Native Development

Reply
Developer
Posts: 404
Registered: ‎04-04-2012
My Device: BlackBerry Z30/Z10/Z10LE/Q10/PlayBook

ListView ItemType Function - last record

I am using an Item type mapping function to choose different containers. I got this from the WeatherGuesser app. In this function it changes the first record below the header to a large list item and the rest are smaller list items. Is there a way to recognize the last item in the list and set that to another list item type?

 

                // Item type mapping
                function itemType (data, indexPath) {
                    if (indexPath.length == 1) {
                        //return 'header';
                        return '';
                    } else if (indexPath.length == 2 && indexPath[0] == 0 && indexPath[1] == 0) {
                        // The top item is a special item so we tell the list it should use that item type.
                        return 'conditionsItem';
                    } else {
                        return 'forecastItem';
                    }
                }

 

Retired
Posts: 329
Registered: ‎05-07-2012
My Device: BB Alpha
My Carrier: N/A

Re: ListView ItemType Function - last record

I am sure you can customize the contents of each item - have you looked at this knowledge base article or custom datamodels?

 

http://supportforums.blackberry.com/t5/Cascades-Development-Knowledge/Using-a-Custom-DataModel-to-Fi...

 

Martin