ui-grid cannot rendered correctly when using ng-show/ng-hide, if you press F12 on the keyboard, it c
来源:互联网 发布:mac在线是什么意思 编辑:程序博客网 时间:2024/05/23 19:18
ui-grid cannot rendered correctly when using ng-show/ng-hide, if you press F12 on the keyboard, it can do it correctly
up vote1down votefavorite2My code is as below:
<div class="gridStyle" ng-grid="gridOptions" ng-show="flag"></div>
when i set the flag to true, the grid cannot render correctly, if you press F12 on the keyboard, it can show correctly!
angularjs ng-grid angular-ui-grid ng-show ng-hide ng-grid also has this issue! – Vino Dang Oct 14 '15 at 10:27 what do you mean by Correctly? doesnt show at all? – Ori Price Oct 14 '15 at 10:32 does it show correctly if you resize your browser window? if that's the case then you might need to call gridApi.core.refresh(); when you change your flag variable (that's for ui-grid. for ng-grid i think you need to call gridOptions.ngGrid.buildColumns(); ) – valepu Oct 14 '15 at 11:40 @OriPrice, it means the page displays incorrectly. – Vino Dang Oct 15 '15 at 3:37 1 @valepu,yes, when i resize my browser window, it can show correctly! For grid i use the $scope.gridOptions.ngGrid.buildColumns(), it show correctly! Thank u very much! – Vino Dang Oct 15 '15 at 3:55 add a comment | show 2 more comments start a bounty3 Answers
activeoldestvotesup vote1down voteunacceptng-grid and ui-grid don't automatically update the table when hidden or shown. By calling gridApi.core.refresh();
(for ui-grid) and gridOptions.ngGrid.buildColumns();
(for ng-grid) you force the library to rebuild the table according to the current DOM situation
Thank u very much! it works! – Vino Dang Oct 21 '15 at 3:25 remember to accept the answer if it's been of help – valepu Oct 21 '15 at 9:22 ok, i have done it, thx – Vino Dang Oct 21 '15 at 12:28 add a commentup vote3down voteacceptWhile I realize this question has aged, none of the solutions worked for me as of today. However, using the ui-grid-auto-resize attribute on my element worked like a charm.
<div ui-grid="gridOptions" class="grid" ui-grid-auto-resize></div>
As per the docs ui-grid.info/docs/#/tutorial/108_hidden_grids setting a width and height worked for me. – vanzylv Oct 24 '16 at 12:20 add a commentup vote3down voteaccepti also find a solution: use ng-if
instead of ng-show
/ng-hide
, like this:
<div class="gridStyle" ng-grid="gridOptions" ng-if="flag"></div>
Using ng-if
also fiexed it for me!
add a comment
更多信息,请查看我的stackoverflow: http://stackoverflow.com/questions/33122848/ui-grid-cannot-rendered-correctly-when-using-ng-show-ng-hide-if-you-press-f12-o
ui-grid cannot rendered correctly when using ng-show/ng-hide, if you press F12 on the keyboard, it can do it correctly
up vote1down votefavorite
2
My code is as below:
<div class="gridStyle" ng-grid="gridOptions" ng-show="flag"></div>
when i set the flag to true, the grid cannot render correctly, if you press F12 on the keyboard, it can show correctly!
angularjs ng-grid angular-ui-grid ng-show ng-hide
ng-grid also has this issue! – Vino Dang Oct 14 '15 at 10:27
what do you mean by Correctly? doesnt show at all? – Ori Price Oct 14 '15 at 10:32
does it show correctly if you resize your browser window? if that's the case then you might need to call gridApi.core.refresh(); when you change your flag variable (that's for ui-grid. for ng-grid i think you need to call gridOptions.ngGrid.buildColumns(); ) – valepu Oct 14 '15 at 11:40
@OriPrice, it means the page displays incorrectly. – Vino Dang Oct 15 '15 at 3:37
1 @valepu,yes, when i resize my browser window, it can show correctly! For grid i use the $scope.gridOptions.ngGrid.buildColumns(), it show correctly! Thank u very much! – Vino Dang Oct 15 '15 at 3:55
add a comment | show 2 more comments
start a bounty
3 Answers
activeoldestvotes
up vote1down voteunaccept
ng-grid and ui-grid don't automatically update the table when hidden or shown. By calling gridApi.core.refresh();
(for ui-grid) and gridOptions.ngGrid.buildColumns();
(for ng-grid) you force the library to rebuild the table according to the current DOM situation
Thank u very much! it works! – Vino Dang Oct 21 '15 at 3:25
remember to accept the answer if it's been of help – valepu Oct 21 '15 at 9:22
ok, i have done it, thx – Vino Dang Oct 21 '15 at 12:28
add a comment
up vote3down voteaccept
While I realize this question has aged, none of the solutions worked for me as of today. However, using the ui-grid-auto-resize attribute on my element worked like a charm.
<div ui-grid="gridOptions" class="grid" ui-grid-auto-resize></div>
As per the docs ui-grid.info/docs/#/tutorial/108_hidden_grids setting a width and height worked for me. – vanzylv Oct 24 '16 at 12:20
add a comment
up vote3down voteaccept
i also find a solution: use ng-if
instead of ng-show
/ng-hide
, like this:
<div class="gridStyle" ng-grid="gridOptions" ng-if="flag"></div>
Using ng-if
also fiexed it for me!
add a comment
更多信息,请查看我的stackoverflow: http://stackoverflow.com/questions/33122848/ui-grid-cannot-rendered-correctly-when-using-ng-show-ng-hide-if-you-press-f12-o
0 0
- ui-grid cannot rendered correctly when using ng-show/ng-hide, if you press F12 on the keyboard, it c
- AngularJS – Conditional Display using ng-show / ng-hide, ng-if, ng-include, ng-switch
- ng-show,ng-hide,ng-if指令
- ng-if ng-show ng-hide 区别
- ng-show/ng-hide
- ng-show ; ng-hide
- ng-if和ng-show、ng-hide区别
- ng-if与ng-show、ng-hide指令的区别
- ng-if、ng-show和ng-hide指令的区别
- ng-if,ng-show,ng-hide的区别
- React实现Angularjs ng-show、ng-if和ng-hide
- angularjs ng-if ng-show ng-hide区别
- ng-if | ng-show | ng-hide的使用场景
- AngularJS的学习--ng-show/ng-hide/ng-if和ng-switch
- AngularJS的学习--ng-show/ng-hide/ng-if和ng-switch
- angular中的显示与隐藏ng-show/ng-hide/ng-if/ng-switch
- 使用了ng-repeat 后的样式显示 ng-class 、ng-hide ng-show ng-if ng-style
- (四下)ng-class指令,ng-style指令,ng-show/ng-hide指令,ng-if指令等....
- oracle下scott用户的四张表(emp,dept,bonus,salgrade)的建表语句:
- mysql插入数据后返回自增ID的方法
- 【ife】任务三十二:表单(四)实现表单自动生成工厂
- Gradle for Android系列之五 多渠道打包
- S/4 HANA – 是ERP皇帝的新装,还是SAP王国的新基石
- ui-grid cannot rendered correctly when using ng-show/ng-hide, if you press F12 on the keyboard, it c
- JAVA之使用键盘输入数据
- java图片裁剪和java生成缩略图
- String的trim()方法无效的解决办法
- DynamicCocoa:滴滴 iOS 动态化方案的诞生与起航
- +-字符串
- sublime格式化代码快捷键+修改tab为4个空格
- 单独使用Quartz 2.1.7 时Job属性Spring无法注入
- 数组中的逆序对