Skip to content

Infragistics Community Forum / Web / Ignite UI for Angular / Make IgxGrid Height Responsive Without Fixed Pixels

Make IgxGrid Height Responsive Without Fixed Pixels

New Discussion
Mahesh Sandhanshiv
Mahesh Sandhanshiv asked on Mar 14, 2019 7:58 AM

I am having issue with grid height. When i resize the screen it will fix the size (because of height in pixcel). I need responsive size of the grid.

I tried to provide height in % but its not working for me. So can you please provide solution, how can i calculate grid height randomly or how can i pass height in %.

Sign In to post a reply

Replies

  • 0
    Mahesh Sandhanshiv
    Mahesh Sandhanshiv answered on Mar 6, 2019 6:13 AM

    And also need help into text alignment of individual columns (right. left, center).

    • 0
      Hristo Anastasov
      Hristo Anastasov answered on Mar 6, 2019 1:26 PM

      Hello Mahesh,

      When setting the grid size in %, please make sure that the grid direct parent has its height set too, so that the grid can calculate properly its own height.

      See this Stackblitz sample: Igx-grid height is set in % and its parent (the .grid__wrapper container, has its height set to 600px – see grid-paging.component.scss):

      .grid__wrapper {
        height: 600px;
        background-color: pink;
      }
      <igx-grid #grid1 height="60%" width="100%">

      Regarding the text alignment – you can use the cellClasses property to apply class to cells in a given column. In the same example, see that the BeatsPerMinite column is left aligned, while all other numeric columns are right aligned.

      Code sample:

       <igx-column field="BeatsPerMinute" [cellClasses]="{'rightAligned' : true }"></igx-column>
        .rightAligned {
          text-align: left;
          justify-content: flex-start;
        }

      Please let me know if you have further questions, I will be glad to help.

      • 0
        Mahesh Sandhanshiv
        Mahesh Sandhanshiv answered on Mar 7, 2019 9:09 AM

        Thanks for your reply.

        I tried cellClasses and its work as expected. However, I am facing issue in grid height. I followed your steps but height not append to igxgrid. Attached image for your reference.

      • 0
        Hristo Anastasov
        Hristo Anastasov answered on Mar 7, 2019 2:01 PM

        Is it possible to send a stackblitz sample demonstrating the height issue ?

        Hristo

      • 0
        Mahesh Sandhanshiv
        Mahesh Sandhanshiv answered on Mar 14, 2019 5:21 AM

        Not possible because to lengthy code is there.  

      • 0
        Hristo Anastasov
        Hristo Anastasov answered on Mar 14, 2019 7:58 AM

        Hi Manesh,

        You can always isolate the sample  and provide it for investigation.

        Do you bind the grid to remote data ? If so, it happens that the grid calculates its height before the data has arrived, which leads to the result described by you. In this case, you need to explicitly set the grid height when the data is available:

        this.remoteDataService.getData().subscribe({
        	next: (respData: any) => {
        		// set grid height
        		this.grid.height = "50%";
        	}
        });

        Please let me know if this is the case or if you need further help with this.

        Hristo

  • You must be logged in to reply to this topic.
Discussion created by
Favorites
Replies
Created On
Last Post
Discussion created by
Mahesh Sandhanshiv
Favorites
0
Replies
6
Created On
Mar 14, 2019
Last Post
7 years ago

Suggested Discussions

Tags

Created by

Created on

Mar 14, 2019 7:58 AM

Last activity on

Feb 23, 2026 7:16 AM