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

Web and WebWorks Development

Posts: 79
Registered: ‎09-17-2012
My Device: Torch 9800
My Carrier: DiGi
Accepted Solution

BB10 - Disable touchstart/touchend when scrolling

Hi all. It's me again. I having trouble trying to get touchstart, touchend and touchmove to work together. 


strPendList += '<div id="pendingContainer" class="pendingContainer">';
	      for(var i = 0; i < len; i++)
            var pendRefNo = data.result[i].refno;
            var pendRequester = data.result[i].requestor;
            var pendDate= data.result[i].date;
            var pendAmount = data.result[i].amt;
            strPendList += '<div class="pendClaimDisplay" ontouchstart="refHighlight(this)" ontouchend="getQClaimParticulars(\''+pendRefNo+'\')">';
			strPendList += '<div class="pendRefLabel">REF NO </div>';
            strPendList += '<div class="pendRefValue">: '+pendRefNo+'</div>';
            strPendList += '<div class="pendRequesterLabel">REQUESTER : </div>';
            strPendList += '<div class="pendRequesterValue maxDisplay">'+pendRequester+'</div>';
            strPendList += '<div class="pendDateLabel">DATE </div>';
            strPendList += '<div class="pendDateValue">: '+pendDate+'</div>';
            strPendList += '<div class="pendAmountLabel">AMOUNT : </div>';
            strPendList += '<div class="pendAmountValue">'+pendAmount+'</div>';
			strPendList += '</div>';//end of pendClaimDisplay
          strPendList += '</div>';//end of pendingContainer

 data.result is being retrieved from web services and will be used to generate listing(pendClaimDislay). The problem I'm having is when I try to scroll, touchend will be fired and calling the getQClaimParticulars function instead of scrolling up and down the listing.


strPendList += '<div class="pendClaimDisplay" onmouseover="refHighlight(this)" onclick="getQClaimParticulars(\''+pendRefNo+'\')">';

 I've tried to to use onmouseover in replace ontouchstart but the selected listing does not get highlighted. 


Is there anyway to to scroll without firing touchstart and touchend too soon?

Posts: 1,230
Registered: ‎03-20-2011
My Device: Playbook, Z10 LE, Dev Alpha B, 2x Dev Alpha C
My Carrier: 3, Orange, Vodafone

Re: BB10 - Disable touchstart/touchend when scrolling

Try something like JSHammer

Click the like button if you find my posts useful!
Posts: 1,561
Registered: ‎04-12-2010
My Device: BlackBerry Z10
My Carrier: Bell

Re: BB10 - Disable touchstart/touchend when scrolling

touchend should only fire *after* the user completes scrolling.


I've come into some situations where I don't want to trigger an action on touchend if the user scrolls. In these cases I do something like so (pseudo-code):


ontouchstart: set scroll flag to false.

ontouchmove: set scroll flag to true.

ontouchend: if scroll flag is still false, execute some function.


This way, a touchmove will prevent a touchend action from occurring.

Erik Oros | @WaterlooErik | eoros@blackberry.com | Developer Issue Tracker

If a reply has answered your question, please click Accept as Solution to help other visitors in the future.
Posts: 79
Registered: ‎09-17-2012
My Device: Torch 9800
My Carrier: DiGi

Re: BB10 - Disable touchstart/touchend when scrolling

Thanks for the solutions.