Skip to content

Infragistics Community Forum / Web / Ignite UI for Angular / Hide IgxGrid Master Detail Expand Icon When No Details

Hide IgxGrid Master Detail Expand Icon When No Details

New Discussion
John McCann
John McCann asked on Jun 2, 2023 8:45 AM

I have a master detail grid where not all master rows will have child details. Currently, the rows with missing details still show the drop down arrow for the detail template. I would like hide the arrow, or template, when the details are missing. I think the trick may be an *ngIf on the ng-template, but I can’t seem to reference the details object to test if it is ‘nothing’ or an empty colleciton.

<ng-template igxGridDetail let-weekdays *ngIf=”weekdays.details.length > 0>
</ng-template>
Sign In to post a reply

Replies

  • 0
    John McCann
    John McCann answered on Jun 1, 2023 11:12 PM

    I think I just answered my question. Instead of using igx-grid, use  igx-hierarchical-grid. Then set the hasChildrenKey property to a property on your parent object that returns true|false if the object has children.

  • 0
    Colby Adkins
    Colby Adkins answered on Jun 2, 2023 3:30 AM

    I believe I simply answered my own question. Use igx-hierarchical-grid instead of igx-grid.  

    geometry dash

  • 0
    Georgi Anastasov
    Georgi Anastasov answered on Jun 2, 2023 8:45 AM

    Hello,

    I am glad that you find solution to your requirements using our components.

    However, I have been looking into your question and I could suggest you as an approach for both grids, the igx-grid master detail and for the igx-hierarchical grid. So, you could choose to use one of the two grids with this approach or the already found solution according to your requirements.

    What will be used are two ng-templates with the igxRowCollapsedIndicator and igxRowExpandedIndicator directives which are responsible for the expand and collapse icons in the igx-grid master details and in the igx-hierarchical-grid. As in the two templates, the two icons with the igx-icon component will be added, to which the text keyboard_arrow_right and keyboard_arrow_down will be submitted. After that, the style.visibility property of the two icons will be handled according to a function that will determine whether for the given row there is certain data, whether to show or hide the expand and collapse icons.

           keyboard_arrow_right
    
    
    
           keyboard_arrow_down
    

    The function will take the given row and check with its date property if it contains the data that should be displayed in the master detail of the igx-grid or in the child row-island of the igx-hierarchical grid. If there is data it will return true and the icon will be visible, if there is no data it will return false, and the icon will be hidden.

    public show(row) {
             if (row.data.country) {
               this.hasData = true;
             } else {
               this.hasData = false;
             }
             return this.hasData;
         }

    However, after we hide the icon, it will still be clickable because it will still be on the given row. This is why we will have to handle the rowToggle event of the grid, which is fired when the expand icon is pressed, that is, when the given row is toggled. When the event is fired, it will be checked whether there is data for the given row that we want to expand in the master detail grid or in its child row-island, and if there is, the row will be expanded, and if there is no data, the event will be canceled and so it will not be expanded in the cases if the hidden expand icon is clicked.

    public rowToggle(event){
            if(!event.rowID.country){
                event.cancel = true;
            }
        }

    The described scenario could be observed here:

    In addition, I have prepared a small sample illustrating this behavior in igx-grid master details which could be found here and another small sample illustrating this behavior in igx-hierarchical-grid here.

    Thank you for your cooperation.

    Regards,

    Georgi Anastasov

    Entry Level Software Developer

    Infragistics

  • 0
    lucky game
    lucky game answered on Jan 23, 2026 11:04 AM

    Lucky 97 Game is popular gaming application in Pakistan that brings casino betting games like slots machines and card games with multiple options. https://lucky-97-game.com/

  • You must be logged in to reply to this topic.
Discussion created by
Favorites
Replies
Created On
Last Post
Discussion created by
John McCann
Favorites
0
Replies
3
Created On
Jun 02, 2023
Last Post
1 month ago

Suggested Discussions

Created by

Created on

Jun 2, 2023 8:45 AM

Last activity on

Feb 24, 2026 7:47 AM