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

How to disable a column click from triggering row selection

I have a custom checkbox column made using queryCellInfo and rendering a react component checkbox. This checkbox has separate functionality from selecting a row from the grid. When I have a row selected and click the checkbox (on the same or different row), it clears my selected row. I want to keep the row selected but be able to toggle the checkbox without it clearing the selected row. 

3 Replies

MS Madhu Sudhanan P Syncfusion Team February 14, 2019 10:26 AM UTC

Hi Ryan, 

Thanks for contacting Syncfusion support. 

We have prepared a sample based on your requirement in which selecting/deselecting is prevented by using rowSelecting and rowDeselecting event as follows. 


export class Default extends SampleBase { 
  target; 
  load(e) { 
    this.element.onclick = (e) => { 
      this.target = e.target; 
    } 
  } 
  deselecting(e) { 
    if (this.target.classList.contains('custom')) { 
      this.target = null; 
      e.cancel = true; 
    } 
  } 
    render() { 
        return (<div className='control-pane'> 
        <div className='control-section'> 
          <GridComponent dataSource={orderDetails} height='350'  
          rowSelecting={this.deselecting}  
          rowDeselecting={this.deselecting}  
          load={this.load}> 
           ..... 
          </GridComponent> 
        </div> 
      </div>); 
    } 
} 



Regards, 
Madhu Sudhanan P 



RN Ryan Ngoh February 14, 2019 08:04 PM UTC

Thanks. I didn't do exactly what you did because I needed to pass state to a react component but I got it working. 


MS Madhu Sudhanan P Syncfusion Team February 15, 2019 05:47 AM UTC

Hi Ryan, 
We are glad that your requirement has been achieved. 
Regards, 
Madhu 


Loader.
Live Chat Icon For mobile
Up arrow icon