Radlistview prevent drag to position index 0


#1

I’ve been trying to figure out a way to prevent drag in listview to the first position which would be index 1. I see on itemReorder event that there is an index and a data.targetIndex, but I can’t seem to cancel based upon the condition that the targetIndex is going to be zero.

public onItemReordered(args: ListViewEventData) {
        console.log("Item reordered. Old index: " + args.index + " " + "new index: " + args.data.targetIndex + " group index: " + args.data.targetGroupIndex);
        if(args.data.targetIndex === 0){
            args.returnValue = false;
        }
    }

#2

I don’t think you can cancel the drop based on target index, itemReordered is fired when reorder is completed. Only itemReorderStarting event supports cancelling the reorder.

May be you can try updating your data in itemReordered event.