Yes
i am trying to disable the swipe action, reorder event on specific items of my ListView
( in my case i am grouping items by date and i want to disable the swipe action on the groupe header which is having template = header)
Both android and ios
onSwipeCellStarted, onSwipeCellFinished, onCellSwiping
if (args.index ===1 || args.index ===2 ) {
return 0 ;
}
this will prevent the event on the specefied items but when you swipe an item of index different than 1 or 2 the swiping event will be activated to the items 1 and 2.
i tried to use "isUserInteractionEnabled" attribute on ng-template but it's not working.
isUserInteractionEnabled
Gets or sets a value indicating whether the user can interact with the view. This does not affect the appearance of the view.
Hello @crostina
You can not use isUserInteractionEnabled on the Angular ng-template.
However, you can change the approach and disable the swipe actions by assigning different swipe limit rules depending on the item index.
For example:
export function onSwipeCellStarted(args: listViewModule.SwipeActionsEventData) {
console.log(args.index); // use the item index to assign or limit the swipe limits
if (args.index >= 3) {
var swipeLimits = args.data.swipeLimits;
var swipeView = args.object;
var leftItem = swipeView.getViewById<viewModule.View>('mark-view');
var rightItem = swipeView.getViewById<viewModule.View>('delete-view');
swipeLimits.left = leftItem.getMeasuredWidth();
swipeLimits.right = rightItem.getMeasuredWidth();
swipeLimits.threshold = leftItem.getMeasuredWidth() / 2;
} else {
var swipeLimits = args.data.swipeLimits;
var swipeView = args.object;
var leftItem = swipeView.getViewById<viewModule.View>('mark-view');
var rightItem = swipeView.getViewById<viewModule.View>('delete-view');
swipeLimits.left = 0
swipeLimits.right = 0;
swipeLimits.threshold = 0;
}
}
With the code above the swipe limit for the first three items are set to 0 which means that the user won't be able to interact with them.
Hello NickIliev
your solution solved my issue thanks a lot.