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. Image for the cookie policy date

Grid : Height to fit screenheight automatically

Dear Syncfusion,

is it possible to set the height of the grid to 100% , so it fits the screen vertically ?

Regards,
Gert

3 Replies

TS Thavasianand Sankaranarayanan Syncfusion Team May 28, 2019 06:19 AM

Hi Gert, 
 
Thanks for contacting Syncfusion support. 
 
Query 1: is it possible to set the height of the grid to 100% , so it fits the screen vertically ? 
 
Yes, it is possible to set height of the grid to “100%”. We have prepared a sample where the grid fits the screen vertically. Please refer the below code snippet and sample link. 
 
[Index.razor] 
<EjsGrid id="Grid" DataSource="@gridData" Height="100%" >     
    <GridColumns> 
        <GridColumn Field="OrderID" HeaderText="Order ID" IsPrimaryKey="true" TextAlign="@TextAlign.Right" Width="120"></GridColumn> 
        .   .   .   . 
    </GridColumns> 
</EjsGrid> 
 
 
@functions { 
    public object gridData { get; set; } 
    protected override void OnInit() 
    { 
        gridData = OrdersDetails.GetAllRecords(); 
    } 
} 
 
 
 
Please get back to us for further assistance. 
 
Regards, 
Thavasianand S. 



DG Devware GmbH January 2, 2020 02:01 PM

Hello Thavasianand,

i have a same problem with the DataGrid Blazor Component. I want the Grid height justify with flexbox but the Grid component is over the browser screen with 100%. If i set the height to for example 300px it´s fine but not sizeable.

Have you a solution for DataGrid with display:flex?

Regards

Tibor



VN Vignesh Natarajan Syncfusion Team January 3, 2020 08:22 AM

Hi Devware,  

Greetings from Syncfusion support.  

Query: “Have you a solution for DataGrid with display:flex? 

We understand that you want to render the grid in the flexbox and want the Grid height to be adjusted within the box. If you want to the Grid to be adjusted inside the parent container, then we suggest you to define the height property of EjsGrid with 100% and also define specific height to parent container (flexbox). So that based on the flexbox height, Grid will be adjusted inside it.   

Refer the below code example.  

<div class="flex-container"> 
    <EjsGrid @ref="Grid" Height="100%" Width="100%" DataSource="@Orders" AllowPaging="true"> 
. . . . . . . . . . . ..  
    </EjsGrid> 
</div> 
<style> 
    .flex-container { 
        display: flex; 
        height: 500px; 
        width: 700px;         
    } 
</style> 
@code{ 

Refer our UG documentation for your reference 


Please get back to us with more details if you are facing any issues.  

Regards, 
Vignesh Natarajan.  
 


Loader.
Live Chat Icon For mobile
Up arrow icon