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 likeng-grid
instead? – DerMike Commented Oct 28, 2016 at 13:57
1 Answer
Reset to default 3If 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
评论列表(0条)