ui-grid icon indicating copy to clipboard operation
ui-grid copied to clipboard

Multiple ui-grids within multiple tabs or divs, which are hidden, not displaying properly

Open ackimwilliams opened this issue 10 years ago • 7 comments

Multiple UI-grids not displaying properly when inside of a tabs or a divs which are hidden.

How to recreate issue:

  1. 3 tabs: A, B, and C
  2. place 1 grid (with unique data and ids) in B and C each
  3. let the page load with grid A showing
  4. When I click tab B, B's grid appears fine, however, clicking tab C, C's grid does not display
  5. Each individual tab's grid displays when I resize the page however.
  6. Navigating to another tabs, its grid is not displayed until you resize this page

Related to: https://github.com/angular-ui/ui-grid/issues/50 https://github.com/angular-ui/ui-grid/issues/581 https://github.com/angular-ui/ui-grid/pull/991

ackimwilliams avatar Feb 21 '16 09:02 ackimwilliams

Having same issue (I believe)

minimal test case:

http://plnkr.co/edit/9Xj9au3RoNMjvl70TWA8?p=preview

just click the button to swap to the 2nd grid (which should be displayed incorrectly), and then resize the screen to see it render correctly.

This is in chrome 48.0.2564.109

tomforster avatar Feb 23 '16 16:02 tomforster

Consider adding: 'ui.grid.autoResize' to your dependancies at run, then add 'ui-grid-auto-resize' to each grid to over come the issue. Alternatively, you can used 'ng-if' instead of 'ng-show' to achieve a similar result.

KegDemon avatar Feb 23 '16 16:02 KegDemon

Worked fine with ui.grid.autoResize and ui-grid-auto-resize. http://plnkr.co/edit/iUdfjPtHZWkh72MtSDuO?p=preview However my issue is with scrolling. I will try to produce another plunker

bhantol avatar Mar 23 '16 21:03 bhantol

I solved this by getting rid of bootstrap tabs and used purely css: visibility: hidden option and position: absolute. I had the exact same requirement as @ackimwilliams.

Why following solutions did not work for me ng-show, angular-ui tabs, display:none solution

ng-show or other variants that use display:none was problematic and also another probem that crops up in Internet Explorer 11 in where if you scroll in one grid and toggle the grid you see blank rows on top.

ng-if ng-if was expensive because it rebuild the doms and created issues with touch events and besides you loose lost the grid state withng-if`. It caused sluggisn response as you clicked on the tabs.

Finally visibility: hidden solution In this plunkr solution for simplicity I am not showing the tabs but a simple toggle button but you get the idea.

yogeshgadge avatar Apr 07 '16 15:04 yogeshgadge

This works for me :+1:

app.js

var appModule = angular.module("app", [
    'ui.grid.autoResize'
]);

Html

<div class="grid" ui-grid="vm.refereeDetailGridOptions" ui-grid-auto-resize></div>

css

.grid {
    width: 980px !important;
}

Sampath-Lokuge avatar Apr 25 '16 10:04 Sampath-Lokuge

Hi @Sampath-Lokuge

I have used your code & it's working absolutely correct. But I have found a issue, in my multiple grid (using tab in a single page) horizontal scroll comes & by using your code, scroll is invisible when I do switching from one tab to another & if we do any thing in page like click on sorting or pagination or page reload then scroll visible. Please help me.

Thank, Nishant

nishantpandya avatar Aug 30 '17 12:08 nishantpandya

Thanks for contributing! This repository has been transferred, and we're preparing the new 5.x release. We're closing older issues and pull requests as part of the reset. Please join us on Discord to follow the work or continue the conversation: https://discord.gg/Baz4w8ZWN

orneryd avatar Aug 12 '26 23:08 orneryd