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. Image for the cookie policy date

Check only one checkbox

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

1 Reply

SS Seeni Sakthi Kumar Seeni Raj Syncfusion Team 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 


Loader.
Live Chat Icon For mobile
Up arrow icon