Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

ListView multiple ItemClick and longpress event.

$
0
0

Hi

I am not able to longpress event with ListView, Lonpress event is fired when I "Long press" on particular section of ListView , but it is not fierd when I "Long press" on item of that particular section, What should I do? I have to do stuff like on Item of section can have both event itemclick and longpress.

here is my test code for that

listviewevent.xml

<Alloy>
    <Window id="win" backgroundColor="white" fullscreen="true" >
        <ListView id="listView" defaultItemTemplate="template">
            <Templates>
                <ItemTemplate name="template">
                    <ImageView bindId="pic" id="icon" />
                    <Label bindId="info" id="title" />
                    <Label bindId="es_info" id="subtitle" />
                </ItemTemplate>
            </Templates>
            <ListSection headerTitle="Fruit / Frutas">
                <ListItem info:text="Apple" es_info:text="Manzana" pic:image="/apple.png" />
                <ListItem info:text="Banana" es_info:text="Banana" pic:image="/banana.png" />
            </ListSection>
            <ListSection headerTitle="Vegetables / Verduras">
                <ListItem info:text="Carrot" es_info:text="Zanahoria" pic:image="/carrot.png" />
                <ListItem info:text="Potato" es_info:text="Patata" pic:image="/potato.png" />
            </ListSection>
            <ListSection headerTitle="Grains / Granos">
                <ListItem info:text="Corn" es_info:text="Maiz" pic:image="/corn.png" />
                <ListItem info:text="Rice" es_info:text="Arroz" pic:image="/rice.png" />
            </ListSection>
        </ListView>
    </Window>
</Alloy>
listviewevent.js
$.listView.addEventListener('click', function(e) {
    alert('Click event');
 
});
$.listView.addEventListener('longpress', function(e) {
    alert('longpress event');
 
});
$.win.open();

here with above code I am getting longpress Event with longpress of sections like Fruits,Veg... etc and itemclick is fired with Apple,banana... etc


Viewing all articles
Browse latest Browse all 8068

Trending Articles



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