How to disable DataGrid detailTemplate property on a click

Hello team

I have a custom checkbox in my DataGrid Toolbar ,and I want to disable detailTemplate 

property by clicking on this chekbox



2 Replies

VB Vinitha Balasubramanian Syncfusion Team July 26, 2022 01:06 AM UTC

Hi Customer,


Greetings from Syncfusion support.


Currently, we are validating the reported query with the provided information at our end. We will provide further details on or before July 27th, 2022.


We appreciate your patience until then.


Regards,

Vinitha Balasubramanian



JC Joseph Christ Nithin Issack Syncfusion Team July 28, 2022 07:47 PM UTC

Hi Customer,


Thanks for your patience.


Based on your query, we have prepared a sample and achieved your requirement using Change event of CheckBox component. On that event, we can disabled the detailedTemplate property by adding (“e-disabled”)
className to the classList.


Kindly refer the below code and sample for your references.


[index.js]

onChange(args) {

    if (!args.checked) {

      this.gridInstance.detailTemplate = this.gridTemplate.bind(this);

      this.gridInstance.refresh();

    } else {

      [].slice

        .call(

          this.gridInstance.element.querySelectorAll('.e-detailrowcollapse')

        )

        .forEach((item=> {

          item.classList.add('e-disabled');

        });

    }

  }


Sample link : https://stackblitz.com/edit/react-i1dw3m-yt5rer?file=index.html,index.js


Please get back to us, if you need any further assistance.


Regards,

Vinitha Balasubramanian



Loader.
Up arrow icon