javascript - How to hide ag-grid if rowData is null? - Stack Overflow

I have a use case where the ag-grid (Angular Grid) I am using must not appear at all if the rowData is

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.

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?

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.

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?

Share Improve this question edited Jan 24, 2020 at 13:46 David 74511 silver badges25 bronze badges asked Jul 29, 2015 at 23:53 lostalienlostalien 1151 silver badge12 bronze badges 3
  • There are many solutions for this problem and if you post code (or create example with jsfiddle or plunker - will be the best) it will really help to give a better advise. – Alex Netkachov Commented Jul 30, 2015 at 0:46
  • it's hard to make a suggestion without seeing the code you have, but using ng-if="rowData" should work.... – Claies Commented Jul 30, 2015 at 0:46
  • I don't think that ag-grid stands for "Angular Grid". Do you use something like ng-grid instead? – DerMike Commented Oct 28, 2016 at 13:57
Add a ment  | 

1 Answer 1

Reset to default 3

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"/>

or

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

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

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

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745207182a4616647.html

相关推荐

  • javascript - How to hide ag-grid if rowData is null? - Stack Overflow

    I have a use case where the ag-grid (Angular Grid) I am using must not appear at all if the rowData is

    10小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信