We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

SfDataGrid - Swipe enable only on specific rows.

Thread ID:

Created:

Updated:

Platform:

Replies:

146600 Aug 9,2019 05:22 PM UTC Aug 12,2019 07:06 AM UTC Xamarin.Forms 1
loading
Tags: SfDataGrid
Christopher
Asked On August 9, 2019 05:22 PM UTC

Hi, I have a data set that contains some elements that are editable/deletable and others that are not. I am displaying these elements using the SfDataGrid. I've enabled swiping and have left and right swipe working. However, its working on all the rows. Is there a way of specifying which rows in the grid should allow swiping?

The best I have manged so far is to make the content of the SwipeTemplate DataTemplate bind IsVisible to the row data so that when the readonly row is swiped there is nothing displayed in the swipe area but the row still swipes.

Ideally I'd like for the read only rows not to swipe at all.

Something along the lines of a QuerySwiping event with a cancel property would do what I need.

Thanks

Subburaj Pandian Veluchamy [Syncfusion]
Replied On August 12, 2019 07:06 AM UTC

Hi Christopher,  
  
Thank you for contacting Syncfusion support. 
 
To cancel swiping for a row based on the conditions you can use SfDataGrid.SwipeStarted event where you can cancel the swiping of the row. 
 
Please refer the following code, 
 
[C#] 
private void DataGrid_SwipeStarted(object sender, SwipeStartedEventArgs e) 
{ 
               //// Here you can get the desired row data, row index of the swiping row. 
               var rowData = e.RowData; 
               var direction = e.SwipeDirection; 
               if(e.RowIndex < 6) 
               { 
                              //// You can cancel the swiping of the row. 
                              e.Cancel = true; 
               } 
}               
 
We have prepared a sample based on your requirement and you can download it from the below link, 
 

We hope this helps. Please let us know, if you would require any further assistance. 
 
Regards,
Subburaj Pandian V  
 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon