如何隐藏AG-格,如果row​​Data是一个空? [英] How to hide ag-grid if rowData is null?

查看:420
本文介绍了如何隐藏AG-格,如果row​​Data是一个空?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我所在的 AG-格(角度网格)我使用不能出现在所有如果row​​Data是一个空的从模型$返回一个用例C $角

I have a use case where the ag-grid (Angular Grid) I am using must not appear at all if the rowData is null that is returned from the Model code.

截至目前我无法找到一种方法,在电网层面做到这一点。

As of now I am unable to find a way to do it at the grid level.

什么是实现这个正确的方式?如果隐藏div元素是为了做到这一点,请问在JavaScript中正确地方法是什么?

What would be the right way to implement this? If hiding the div element is the way to do it, how does one doit in aright way from JavaScript?

推荐答案

如果你想隐藏网格,如果没有行,然后用NG-IF或NG-秀,指着gridOptions.data。

If you want to hide the grid if no rows, then use an ng-if or an ng-show, pointing to the gridOptions.data.

<div ng-grid="gridOptions" ng-show="gridOptions.rowData.length>0"/>

<div ng-grid="gridOptions" ng-if="gridOptions.rowData.length>0"/>

如果您使用的节目,那么网格将呆在那里,但角将适用于CSS来隐藏元素。

If you use show, then the grid will stay there, but Angular will apply css to hide the element.

如果您使用的是否,那么电网指令将不会被AngularJS,直到你有rowData中的数据present初始化。

If you use if, then the grid directive will not be initialised by AngularJS until you have data present in rowData.

这篇关于如何隐藏AG-格,如果row​​Data是一个空?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆