attach swipe event on a view

Hi,
I have a view with some component inside and I want to attach a swipe event to switch to another view. But views, layouts or multiviews haven’t method ‘attachEvent’, so How can I attach an event to all the elements of my view without attach the event element by element ?

multiview element has events and all related api

As for layouts and basic views - they have not, but you can use something like next to add the events to any component

dhx.extend($$(‘mylayout’), dhx.EventSystem);

where mylayout - id of element in question

Ok thanks it’s works with ‘dhx.extend’, so I have two others question cause the documentation on touch event isn’t complete.

1- What is the event object you mention in this example ?

$$('mylist').attachEvent("onSwipeX", function(e){
   //this  == mylist
   //e - event object
});

2- How can I now in which direction I swipe on the screen (left, right, top, bottom) ?

You can try to use

some.attachEvent("onSwipeX", function(start_event, end_event){ var direction = start_event.x > end_event.x; do_some(); });

All touch handler provides two event object - start context of touch action and current context of touch action.

Event object contains next properties

ev.x - x position
ev.y - y position
ev.time - timestamp of action
ev.target - html node for which action occurs

OK thanks for your help