Reorder list - pin certain items


#1

I have a reorder list working, but I want some of the items to not be draggable. Is there a way to set certain items to not allow them to be dragged? I added the reorder handle to the templates I want to be dragged, but the ones I don’t want to be dragged, even though they don’t have handles, they are still draggable.


#2

Use the itemReorderStartingEvent event.


#3

I’ve tried and can’t seem to get that event to fire.

<RadListView #dragList [items]="dataItems" 
			itemReorder="true" 
			(itemReordered)="onItemReordered($event)" 
			(itemReorderStartingEvent)="onItemReorderStarted($event)"
			[itemTemplateSelector]="templateSelector"
			reorderMode="Drag"
			>
public onItemReorderStarted(args: ListViewEventData){
        let item = this._dataItems.getItem(+args.index);
        console.log("On Item Reorder Started");
        if (item['key'] === 'category'){
            return args.returnValue = false;
        }
    }

I never see a console.log in my terminal when I start reordering.


#4

That’s the event name constant, when you use the even name directly it should be (itemReorderStarting)="...")


#5

Thanks @manojdcoder. How did you figure this out? I can’t find reference to itemReorderStarting in the documentation or the api. Everything says ‘itemReorderStartingEvent’


#6

Pro UI’s documentation may not be detailed, but if you refer the basics of NativeScript event handling, this is the usual procedure they follow while defining events.