简体   繁体   English

离子4和ag-grid

[英]Ionic 4 and ag-grid

I cant see the same view of ag grids in mobile view. 我无法在移动视图中看到相同的ag网格视图。 This is supposed to be a hybrid app. 这应该是一个混合应用程序。 what should I do to make it look same in mobile as well? 我该怎么做才能让它在移动设备上看起来一样?

I have tried using the percentage scale of height and widths but still cant resolve the issue. 我尝试使用高度和宽度的百分比刻度,但仍然无法解决问题。

<ion-content>
    <div style="height:500px"> 
       <ag-grid-angular 
            style="width: 100%; height: 100%;" 
            class="ag-theme-balham"
            [rowData]="rowData" 
            [columnDefs]="columnDefs"
        >
        </ag-grid-angular>
    </div>
</ion-content>

I want the mobile view and desktop view to have the complete grid. 我希望移动视图和桌面视图具有完整的网格。

The problem with container div of your ag-grid is that you are setting an absolute value of 500px, which is why your ag-grid will only occupy 500px in height, regardless of the device size. ag-grid的容器div的问题在于,您设置的绝对值为500px,这就是为什么无论设备大小如何,您的ag-grid只会占据500px的高度。

If your intention is to fill up the entire viewport, I would recommend you to use viewport height instead. 如果您打算填满整个视口,我建议您使用视口高度。 The CSS property for that is vh . 这个的CSS属性是vh

<div style="height:100vh">
  <ag-grid-angular 
    style="width: 100%; height: 100%;" 
    class="ag-theme-balham"
    [rowData]="rowData" 
    [columnDefs]="columnDefs"
    >
  </ag-grid-angular>
</div>

I have made a demo over here . 我在这里做了一个演示。 You may open use the 'open in new window' tab on stackblitz to view them on different viewport sizes. 您可以打开使用stackblitz上的“在新窗口中打开”选项卡,以在不同的视口大小上查看它们。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM