How add SwitchComponent in toolbar TreeGrid

Hi team    

I would to add a SWitchComponent to the toolbar of gridComponent


7 Replies

PS Pon Selva Jeganathan Syncfusion Team July 14, 2022 01:39 PM UTC

Hi Saidaniyosra,


Thanks for contacting syncfusion forum.


Query: I would to add a SwitchComponent to the toolbar of gridComponent


We achieved your query by using the toolbar template feature and toolbar click event of the treegrid component. In the toolbar click event will triggers, when toolbar item is clicked.


Please refer to the below code example,


  <TreeGridComponent

              dataSource={treesampleData}

              treeColumnIndex={1}

              childMapping="subtasks"

              height="350"

              allowPaging={true}

              allowFiltering={true}

              toolbar={this.toolbarOptions}

              ref={(treegrid=> (this.treegridObj = treegrid)}

              toolbarClick={this.toolbarClick.bind(this)}

              filterSettings={type: 'Menu' }}

              pageSettings={pageSize: 11 }}

 

 

……..

 

toolbarOptions = [

    'ExpandAll',

    'CollapseAll',

    { text: 'Quick Filter'tooltipText: 'Quick Filter'id: 'filter' },

    { type: 'Input'template: this.templateswitchid: 'switchcom' },

  ];

  toolbarClick(args) {

    if (args.item.id === 'filter') {

      this.treegridObj.filterByColumn('taskName''startswith''Testing');

    } else if (args.item.id == 'switchcom') {

//here you handle switch component

      alert('This is Switch component change event');

    }

  }

  

…..

 

 templateswitch = new Switch({

    label: 'Click',

    checked: false,

    change: this.onChange.bind(this),

  });

 


Please refer to the below sample,

https://stackblitz.com/edit/react-sbdirp?file=package.json,index.js


Please refer to the below API documentation,

https://ej2.syncfusion.com/documentation/api/treegrid#toolbarclick


Kindly get back to us for further assistance


Regards,
Pon selva




SA saidaniyosra replied to Pon Selva Jeganathan July 15, 2022 04:04 PM UTC

Hello,

Thank you for the reply. 




PS Pon Selva Jeganathan Syncfusion Team July 18, 2022 02:31 PM UTC

Hi Saidaniyosra,


Thanks for the update.


Kindly get back to us for further assistance. We are happy to assist you.


Regards,

Pon selva



SA saidaniyosra July 21, 2022 02:20 PM UTC

Hello team,

I want to add detailsTemplate to TreeGridComponent with react

can you help me please?

like this 




PS Pon Selva Jeganathan Syncfusion Team July 22, 2022 11:40 AM UTC

Hi Saidaniyosra,


Thanks for the update.


Query: I want to add detailsTemplate to TreeGridComponent with react


We achieved your query by using the detailTemplate property of the treegrid component. And we have already discussed the same(detail template feature ) in our help documentation.


Please refer to the below help documentation,

https://ej2.syncfusion.com/react/documentation/treegrid/row/row/#detail-template


Please refer to the below demo link,

https://ej2.syncfusion.com/react/demos/#/bootstrap5/treegrid/detail-template


Please refer to the below API documentation,

https://ej2.syncfusion.com/documentation/api/treegrid/#detailtemplate


Kindly get back to us for further assistance


Regards,
Pon selva



SA saidaniyosra July 22, 2022 08:46 PM UTC

Hello,

Thank you for the reply. 


PS Pon Selva Jeganathan Syncfusion Team July 25, 2022 03:19 PM UTC

Hi Saidaniyosra,


Thanks for the update.


Kindly get back to us for further assistance. We are happy to assist you.


Regards,

Pon selva



Loader.
Up arrow icon