SwipeAction - How to Get List_Id when Edit/Delete Button


#1

Hello, I’m using this below code, swipe action is totally work, but i don’t know how to get list_id when tap. please, help me!

VVVVV

<RadListView row=“1” id=“radlistview” [items]=“myItems” itemSwipe=“true” (itemSwipeProgressStarted)=“onSwipeCellStarted($event)” (loadMoreDataRequested)=“onScrollEnded()”>

<Label [text]=’"" + reg.regId +". " + reg.StudentName’>

<GridLayout tkListItemSwipeTemplate columns=", *, *, *" id=“right-stack”>

<GridLayout col=“1” class=“viewGridLayout” (tap)=“tapView(reg.regId)” id=“btnView”>

<GridLayout col=“2” class=“editGridLayout” (tap)=“tapEdit()” id=“btnEdit”>

<GridLayout col=“3” class=“deleteGridLayout” (tap)=“tapDelete()” id=“btnDelete”>


#2

I’m not sure what you mean by list_id but if that is about the data item on which user performed swipe then you may try this in your controller,

onSwipeCellStarted(event: SwipeActionsEventData) {
  let data = event.mainView.bindingContext;
 // do anything you want with your data
}

In case of edit or delete button inside your swipe layout you can do this,

<GridLayout col=“2” class=“editGridLayout” (tap)=“tapEdit($event)” id=“btnEdit”>
<GridLayout col=“3” class=“deleteGridLayout” (tap)=“tapDelete($event)” id=“btnDelete”>
tapEdit(event: ListViewEventData) {
 let data = event.view.bindingContext;
 // do anything you want with your data
}

#3

Thanks for your reply @manojdcoder

I want to get item list 's ID when tap ‘Edit Button’.

Please, see my above code!


#4

You mean the id of the list which is radlistview here in your example code?


#5

Please, see @manojdcoder


#6

@Chit_Oo Thats exactly what I explained. You should be able to do that with my previous answer. Pass in the $event to the tap handlers and event.view.bindingContext.regId should give you what you need.


#7

Thanks a lot @manojdcoder

That’s work!!!