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: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Automatic child data update

Thread ID:

Created:

Updated:

Platform:

Replies:

148348 Oct 16,2019 07:17 AM UTC Oct 18,2019 09:29 AM UTC Angular - EJ 2 1
loading
Tags: Grid
Dinesh D
Asked On October 16, 2019 07:17 AM UTC

I used hirarchical tree structure data table. I that i have button to add the child elements, After adding the child without refreshing it should show the data in table. But i am getting the data after refreshing the grid table. What is the way to update the child data dynamically

+ icon is used to add the child data to the parent OAM.


Thavasianand Sankaranarayanan [Syncfusion]
Replied On October 18, 2019 09:29 AM UTC

Hi Dinesh, 

Greetings from Syncfusion support. 
 
Based on your query, we have prepared a sample and achieved your requirement in click event. we suggest you to follow the below way to achieve your requirement. Please refer the below sample and code example for more information. 

<ejs-grid #grid id='Grid' [dataSource]='hierarchygrid' (load)='onLoad($event)' [childGrid]='childGrid'> 
        <e-columns> 
                 <e-column headerText='Button' width='150' textAlign='Center'> 
                <ng-template #template let-data> 
                    <div class="button"> 
                        <button ejs-button (click)="onClick($event)" #button>Buttons</button> 
                    </div> 
                </ng-template> 
            </e-column> 
        </e-columns> 
    </ejs-grid> 
 
onClick(args) { 
    var tr = args.target.closest('tr'); 
    var childId = tr.nextElementSibling.getElementsByTagName('div')[0].getAttribute('id'); 
    var grid = (document.getElementById(childId) as any).ej2_instances[0]; 
    if (tr.firstElementChild.getAttribute("aria-expanded") && grid) { 
      var data = { "id": 1, "Data": "Raja", "Adress": "shdgsjh", "contach": "973763633" }; 
      grid.editModule.addRecord(data, 0); 
    } 
  } 


Regards, 
Thavasianand S. 


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

Live Chat Icon For mobile
Live Chat Icon