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 disable a column click from triggering row selection

Thread ID:

Created:

Updated:

Platform:

Replies:

142656 Feb 13,2019 03:25 PM UTC Feb 15,2019 05:47 AM UTC React - EJ 2 3
loading
Tags: Grid
Ryan Ngoh
Asked On February 13, 2019 03:25 PM UTC

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. 

Madhu Sudhanan P [Syncfusion]
Replied On 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 


Ryan Ngoh
Replied On 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. 

Madhu Sudhanan P [Syncfusion]
Replied On February 15, 2019 05:47 AM UTC

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


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

;