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: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to keep one row always selected

Thread ID:

Created:

Updated:

Platform:

Replies:

142595 Feb 11,2019 06:44 PM UTC Feb 13,2019 04:17 AM UTC React - EJ 2 3
loading
Tags: Grid
Ryan Ngoh
Asked On February 11, 2019 06:44 PM UTC

I am using selection mode single and want to always have one row selected. I have persistSelection: true on selectionSettings but when I have a row already selected and click on another row, it does not select the new row. There are no rows selected. How do I select rows properly with persistSelection true?

Pavithra Subramaniyam [Syncfusion]
Replied On February 12, 2019 06:11 AM UTC

Hi Ryan, 

Greetings from Syncfusion. 

Query: I have a row already selected and click on another row, it does not select the new row. There are no rows selected. 

We have analyzed your query and for your requirement, multiple type selection or checkbox selection has to be enabled to use the persistSelection property by default. So in the below sample, we have achieved your requirement by using the rowSelecting method of the grid to have only one row selected. Please refer to the below sample for your reference, 

Code Example:  

[.html] 
... 
rowSelecting(args){ 
      if(this.gridInstance.getSelectedRecords().length){ 
        this.gridInstance.clearSelection(); 
      } 
    } 
... 

Sample               : https://stackblitz.com/edit/react-zylwjt?file=index.js  


Please get back to us for further assistance. 

Regards,  
Pavithra S. 
 


Ryan Ngoh
Replied On February 12, 2019 05:06 PM UTC

Thanks.

Pavithra Subramaniyam [Syncfusion]
Replied On February 13, 2019 04:17 AM UTC

Hi Ryan,  

Thanks for your update.  

Please contact us if you need any further assistance. As always, we will be happy to assist you.  

Regards,  
Pavithra S. 


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

;