Quantcast
Channel: Appcelerator Developer Center Q&A Tag Feed (template)
Viewing all articles
Browse latest Browse all 26

Multiple Buttons in Listview Template

$
0
0

Hello,

How can i add multiple Buttons on ListView Template and add an eventhandler? So far i got this. But i get an empty list with no buttons.

_.each(results, function(result, id){
            var resultSection = Ti.UI.createListSection({
                headerTitle: "Results "+result.Title
            });
 
            var resultItems = [];
            _.each(result.Placing, function(record, place){
                resultItems.push({
                    template: 'resultsTemplate',
                    properties: {
                        person1: {
                            'key': record.person1_id,
                            'title': record.person1_name
                        },
                        person2: {
                            'key': record.person2_id,
                            'title': record.person2_name
                        },
                        accessoryType: Ti.UI.LIST_ACCESSORY_TYPE_NONE, 
                        itemId: id
                    }
                });
            });
            resultSection.setItems(resultItems);
            sections.push(resultSection);
        });
Alloy Listview
<ListView id="eventTable" backgroundColor="#FFF">
<Templates>
<ItemTemplate name="resultsTemplate">
    <Button bindId="person1" textAlign="left" top="40" left="0" onClick="showPersonDetail"></Button>
    <Button bindId="person2" textAlign="left" top="80" left="0" onClick="showPersonDetail"></Button>
</ItemTemplate>
</Templates>
</ListView>

Viewing all articles
Browse latest Browse all 26

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>