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

Check only one checkbox

Thread ID:

Created:

Updated:

Platform:

Replies:

149167 Nov 16,2019 09:47 PM UTC Nov 18,2019 10:18 AM UTC React - EJ 2 1
loading
Tags: Grid
peter
Asked On November 16, 2019 09:47 PM UTC

Hello,

I don't know if this is intended or not but when  checkboxOnly is set to trueenableSimpleMultiRowSelection is set to false and type is set to Single in the SelectionSettings, I can still select multiple checkboxes.
If this is intended, how can I do so that only one checkbox is selected.

Thank you

Seeni Sakthi Kumar Seeni Raj [Syncfusion]
Replied On November 18, 2019 10:18 AM UTC

Hi peter, 

Thanks for contacting us 

We could see that you want to select only one record in the Grid with the checkbox at a time. By default, checkbox selection feature enable the grid selection type as ‘Multiple’. You can achieve your requirement by clearing the row selection in rowSelecting event. Please refer the below code example and sample for information. 

import { render } from 'react-dom'; 
import './index.css'; 
import * as React from 'react'; 
import { GridComponent, ColumnsDirective, ColumnDirective, Page, Selection, Inject, Edit, Toolbar } from '@syncfusion/ej2-react-grids'; 
import { data } from './data'; 
import { SampleBase } from './sample-base'; 
export class CheckboxSelection extends SampleBase { 
    constructor() { 
        super(...arguments); 
        this.selectionsettings = { persistSelection: true }; 
        this.toolbarOptions = ['Delete']; 
        this.editSettings = { allowDeleting: true }; 
    } 
    
    rowSelecting() { 

    this.gridInstance.clearSelection(); 
   } 
    render() { 
        return (<div className='control-pane'> 
                <div className='control-section'> 
                    <GridComponent dataSource={data} ref={grid => this.gridInstance = grid} enableHover={false} allowPaging={true} rowSelecting={this.rowSelecting.bind(this)} pageSettings={{ pageCount: 5 }} selectionSettings={this.selectionsettings} toolbar={this.toolbarOptions} editSettings={this.editSettings}> 
                    </GridComponent> 
                </div> 
            </div>); 
    } 

render(<CheckboxSelection />, document.getElementById('sample')); 



Please get back to us if you need further assistance. 

Regards, 
Seeni Sakthi Kumar 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