I had almost the same problem with 'Drag and Drop'. First of all you need to try to drag not a table but cell in it. The second point is timeout. As usual application has timeout to react on drag (touch and hold). it can be like 1 or 2 seconds for this operation. Try to increase timeout parameter for dragFromToForDuration. For my application it was enough to set 6 - 8 seconds.
Try to implement your own function that will take 2 parameters. First parameter - cell object you want to drag. Second parameter - another cell object where you dragged cell will be dropped. NOTE that this function will work only if both of FROM and TO objects will be visible on the screen.
function reorderCellsInTable(from, to)
{
if ( from.checkIsValid() && to.checkIsValid() )
{
if ( !from.isVisible() )
{
from.scrollToVisible();
//put 1 second delay if needed
}
var fromObjRect = from.rect();
// setting drag point into the middle of the cell. You may need to change this point in order to drag an object from required point.
var sourceX = fromObjRect.origin.x + fromObjRect.size.width/2;
var sourceY = fromObjRect.origin.y + fromObjRect.size.height/2;
var toObjRect = to.rect();
// setting drop point into the middle of the cell. The same as the drag point - you may meed to change the point to drop bellow or above the drop point
var destinationX = toObjRect.origin.x + toObjRect.size.width/2;
var destinationY = toObjRect.origin.y + toObjRect.size.height/2;
UIATarget.localTarget().dragFromToForDuration({x:sourceX, y:sourceY}, {x:destinationX, y:destinationY}, 8);
}
}
For example you have 5 cells. You need to drag the second one and to put it at the end. Example of function call:
var cellToReorder = tableView()[<your table view>].cells()[<cell#2NameOrIndex>];
var cellToDrop = tableView()[<your table view>].cells()[<cell#5NameOrIndex>];
reorderCellsInTable(cellToReorder, cellToDrop);