How to remove a child's children column field without its column source.

Hello ,

The syncfusion grid is pretty dynamic and displays the grid even if we do not define a columnSource. 

Assume that I have a grid with the following structure :

In app.component.ts

this.secondChild = {
     dataSource: secondDataSource,
     queryString: "id",
};

this.firstGrid  = {
     dataSource: firstDataSource,
     queryString: "id",
     childGrid: this.secondChild
};

in app.component.html
<ejs-grid 
     [dataSource] = "someDataSource"
     [childGrid] = "firstGrid"
>
</ejs-grid>

Now I havent passed anything as a columnSource for the secondGrid but the grid is displaying fine. How would I remove a specific field/column inside the secondChildGrid ?
Also how would I run queryCellInfo for the childGrids ?


Warm Regards 
Vigneswaran

1 Reply 1 reply marked as answer

BS Balaji Sekar Syncfusion Team January 21, 2021 07:43 AM UTC

Hi Vigneswaran, 
 
Greetings from the Syncfusion support. 
 
Query #1:  How would I remove a specific field/column inside the secondChildGrid ? 
 
Based on your query we have hide the Grid’s column from the secondChildGrid using dataBound event. In this event we have hide the “Address” column using hideColumns method of Grid. 

Please refer the below code example and sample for more information. 
[app.component.ts] 
this.secondChildGrid = { 
      dataSource: customerData, 
      queryString: "CustomerID", 
      dataBound: function() { 
        this.hideColumns(["Address"]); 
      }, 
      columns: [ 
        { 
          field: "CustomerID", 
          headerText: "Customer ID", 
          textAlign: "Right", 
          width: 75 
        }, 
        { field: "Phone", headerText: "Phone", width: 100 }, 
        { field: "Address", headerText: "Address", width: 120 }, 
        { field: "Country", headerText: "Country", width: 100 } 
      ] 
    }; 
 
 
 
Query #2: How would I run queryCellInfo for the childGrids ? 
 
Before proceeding your query please confirm that you need to define the queryCellInfo event in the ChildGrids or manually to call the queryCellInfo event and share to us that will help to validate further. 

Regards, 
Balaji Sekar 


Marked as answer
Loader.
Up arrow icon