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

Single selection of row using checkbox not working in grid

Thread ID:

Created:

Updated:

Platform:

Replies:

143801 Apr 5,2019 07:21 AM UTC Apr 5,2019 10:27 AM UTC Angular - EJ 2 3
loading
Tags: Grid
Goutham
Asked On April 5, 2019 07:21 AM UTC

Hi,
     
     I am using grid for single selection of row at any point i.e only one row should be selected,if another row is selected, previous row should be unselected.For this purpose i am using type as single in selection setting property,But Not working as expected.

Or if any another way to do this functionality please suggest me. 

Thank you.

Pavithra Subramaniyam [Syncfusion]
Replied On April 5, 2019 08:57 AM UTC

Hi Goutham, 
 
Greetings from Syncfusion. 
 
By default Checkbox selection is used for multiple Grid row selection. So if you want to maintain only one selected row, You can achieve your requirement by using the “rowSelecting” event of Grid component. Please refer to the below code example, documentation link and sample link. 
 
[component.ts] 
@Component({ 
    selector: 'app-root', 
    templateUrl: ' <ejs-grid #grid [dataSource]='data' allowPaging='true' [allowSelection]="true" [editSettings]='editSettings' (rowSelecting)='rowSelecting($event)'> 
        <e-columns> 
            <e-column type='checkbox' width='50'></e-column> 
             .   .  . 
        </e-columns> 
    </ejs-grid> ', 
}) 
export class AppComponent { 
    .   .  . 
    rowSelecting(e){ 
      if(this.grid.getSelectedRecords().length){  
        this.grid.clearSelection();  
      }  
    } 
} 
  
                              https://ej2.syncfusion.com/angular/documentation/api/grid/#getselectedrecords 
                              https://ej2.syncfusion.com/angular/documentation/api/grid/#clearselection 
 
 
Please get back to us if you need further assistance. 
 
Regards, 
Pavithra S. 


Goutham
Replied On April 5, 2019 10:02 AM UTC

Thank you for quick response.

Pavithra Subramaniyam [Syncfusion]
Replied On April 5, 2019 10:27 AM UTC

Hi Goutham, 
 
Thanks for your update. 
 
Please get back to us if you have any concern. 
 
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

Live Chat Icon For mobile
Live Chat Icon