Search code examples
appceleratortablerowswipe-gesture

Appcelerator TableViewRow custom swipe event


Using Titanium Appcelerator SDK 1.7.1 for iOS 4.3

I have a TableViewRow and need to fire a custom swipe event on it (rather than the default editable delete) so that I can show 2 buttons. One marking the row as complete, the other removing the row.

The problem is that apparently the swipe event isn't allowed on the TableViewRow element.

I've tried using the Swipe event, the touchstart event and the touch move event, all with a callback of alert('woot! your finger moved!') but the callback is never fired ...

Has anybody had and resolved this issue?


Solution

  • This should work.

    myTableview.addEventListener('swipe', function(eventObject){     
        Titanium.API.info("huzzah, a row was swiped");
    });
    

    What does your code look like?

    EDIT: Do your rows have data in them? If not see if putting data in your rows help.

    EDIT: These are the events that are passed to the swipe event so you can get the row swiped with source.

    direction   direction of the swipe - either left or right
    globalPoint a dictionary with properties x and y describing the point of the event in screen coordinates
    source  the source object that fired the event
    type    the name of the event fired
    x   the x point of the event in receiving view coordiantes
    y   the y point of the event, in receiving view coordinates