Page 1 of 2

Is it possible to add Swipe event to Grid Component?

Posted: Mon Mar 31, 2014 4:28 am
by Milton Davis

I have a grid component with several images and labels in it. Is it possible to add a Swipe event to the grid instead of each component individually?


Is it possible to add Swipe event to Grid Component?

Posted: Mon Mar 31, 2014 7:13 am
by Kateryna Grynko

Hi Milton,

You would need some custom JavaScript.
Run this code on page Load event:
pre$(document).off("swipe", '[name="mobilegridName"]').on({
swipe: function() {
debugger;
},
}, '[name="mobilegridName"]');/pre


Is it possible to add Swipe event to Grid Component?

Posted: Mon Mar 31, 2014 4:12 pm
by Milton Davis

I am not sure I completely understand. The Javascript you provided, is document the page I am loading..."newScreen".

Where does this Javascript allow me to set different actions for Swipe Left or Swipe Right?

And where do I define what action I want to take once the Swipe is triggered?


Is it possible to add Swipe event to Grid Component?

Posted: Tue Apr 01, 2014 3:48 am
by Alena Prykhodko

Hi Milton.

Please try this code instead of suggested above:
pre

$(document).off("swipe");

//Note: "mobilegrid_56" is component name you need to handle swipe events.
Appery("mobilegrid_56").on({
"swipeleft": function(event) {
//Here is code to handle swiptLeft event.
console.log("swipeLeft");
},

Code: Select all

 "swiperight": function(event) { 
     //Here is code to handle swiptRight event. 
     console.log("swipeRight"); 
 },     

});/pre


Is it possible to add Swipe event to Grid Component?

Posted: Tue Apr 01, 2014 4:19 am
by Milton Davis

Do I need to change "$(document)" to the page name?


Is it possible to add Swipe event to Grid Component?

Posted: Tue Apr 01, 2014 5:25 am
by Nikita

Hello,

No.

You don't need to change this code:

$(document).off("swipe");


Is it possible to add Swipe event to Grid Component?

Posted: Tue Apr 01, 2014 5:58 am
by Milton Davis

This code seems to work if I add it to an Image component or a label, but not for a grid. I guess the other option is to add it for all components inside the grid. Is there a way to do that easily....something like,

(document).off("swipe");
//Note: "mobilegrid_56" is component name you need to handle swipe events.
Appery("mobilegrid_56", "mobilegrid_57", "mobilegrid_58").on({
"swipeleft": function(event) {
//Here is code to handle swiptLeft event.
console.log("swipeLeft");
},
"swiperight": function(event) {
//Here is code to handle swiptRight event.
console.log("swipeRight");
},
});


Is it possible to add Swipe event to Grid Component?

Posted: Tue Apr 01, 2014 10:20 am
by Kateryna Grynko

Hi Milton,

No, see this comment: https://getsatisfaction.com/apperyio/...

You would only need to change a grid name, nothing more.


Is it possible to add Swipe event to Grid Component?

Posted: Tue Apr 01, 2014 2:35 pm
by Milton Davis

Hi Katya,

I changed the grid name, but could not get it to work. It would not detect a swipe command. If I used a different component instead of the grid, it worked, but not with the grid.


Is it possible to add Swipe event to Grid Component?

Posted: Wed Apr 02, 2014 12:31 am
by Igor

Hello,

It should work. Could you show us screenshots with grid properties(where we can see a grid name) and screenshot with code which your are using.