{"action":"created","issue":{"url":"https://api.github.com/repos/ceolter/ag-grid/issues/1293","repository_url":"https://api.github.com/repos/ceolter/ag-grid","labels_url":"https://api.github.com/repos/ceolter/ag-grid/issues/1293/labels{/name}","comments_url":"https://api.github.com/repos/ceolter/ag-grid/issues/1293/comments","events_url":"https://api.github.com/repos/ceolter/ag-grid/issues/1293/events","html_url":"https://github.com/ceolter/ag-grid/issues/1293","id":192748463,"number":1293,"title":"sizeColumnsToFit breaks if multiple ag-grids exist on different tabs","user":{"login":"h3adache","id":320283,"avatar_url":"https://avatars.githubusercontent.com/u/320283?v=3","gravatar_id":"","url":"https://api.github.com/users/h3adache","html_url":"https://github.com/h3adache","followers_url":"https://api.github.com/users/h3adache/followers","following_url":"https://api.github.com/users/h3adache/following{/other_user}","gists_url":"https://api.github.com/users/h3adache/gists{/gist_id}","starred_url":"https://api.github.com/users/h3adache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/h3adache/subscriptions","organizations_url":"https://api.github.com/users/h3adache/orgs","repos_url":"https://api.github.com/users/h3adache/repos","events_url":"https://api.github.com/users/h3adache/events{/privacy}","received_events_url":"https://api.github.com/users/h3adache/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-12-01T03:52:23Z","updated_at":"2016-12-05T11:46:10Z","closed_at":null,"body":"An example of this is when you have 3 tabs. Calling `sizeColumnsToFit` would sometimes return an error that the grid is coming back with zero width.\r\nThat is because it calls a function: getWidthForSizeColsToFit which uses an ebody that is set to be a global selector for `.ag-body`. This wouldn't work if you have multiple grids hidden by tabs as you see from the below console code.\r\n\r\n```\r\ndocument.querySelectorAll(\".ag-body\").forEach((x) => console.log(x.clientWidth))\r\n0\r\n1678\r\n0\r\n```\r\n\r\nThis is only tested in chrome but it seems that it's either a bug or a there's missing documentation about how to use ag-grid within multiple tabs? (using bootstrap tabs atm).\r\n"},"comment":{"url":"https://api.github.com/repos/ceolter/ag-grid/issues/comments/264834572","html_url":"https://github.com/ceolter/ag-grid/issues/1293#issuecomment-264834572","issue_url":"https://api.github.com/repos/ceolter/ag-grid/issues/1293","id":264834572,"user":{"login":"ceolter","id":6539563,"avatar_url":"https://avatars.githubusercontent.com/u/6539563?v=3","gravatar_id":"","url":"https://api.github.com/users/ceolter","html_url":"https://github.com/ceolter","followers_url":"https://api.github.com/users/ceolter/followers","following_url":"https://api.github.com/users/ceolter/following{/other_user}","gists_url":"https://api.github.com/users/ceolter/gists{/gist_id}","starred_url":"https://api.github.com/users/ceolter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ceolter/subscriptions","organizations_url":"https://api.github.com/users/ceolter/orgs","repos_url":"https://api.github.com/users/ceolter/repos","events_url":"https://api.github.com/users/ceolter/events{/privacy}","received_events_url":"https://api.github.com/users/ceolter/received_events","type":"User","site_admin":false},"created_at":"2016-12-05T11:46:10Z","updated_at":"2016-12-05T11:46:10Z","body":"```.ag-bodies that have 0 clientWidth have 0 width because they are hidden under tabs``` -> agreed, but nothing i can do here, if grid not visible, then no way for it to know how to spread the columns. however i don't think this is your problem, the problem is....\r\n\r\n```Calling gridOptions.api.sizeColumnsToFit() seems to call sizeColumnsToFit for all grids that were defined``` that should definitely no happen. something wrong with your setup! the gridOptions.api as a reference to ONE gridPanel object, and calls sizeColumnsToFit() on that. if you provide a plunker I can take a look? otherwise you can try debugging through it, see what is happening?\r\n\r\nmy guess is you have somehow confusing references to the gridOptions, or somehow getting the grids mixed up.\r\n"}}
{"actor":{"display_login":"ceolter"}}