{"action":"created","issue":{"url":"https://api.github.com/repos/pzuraq/liquid-tether/issues/39","repository_url":"https://api.github.com/repos/pzuraq/liquid-tether","labels_url":"https://api.github.com/repos/pzuraq/liquid-tether/issues/39/labels{/name}","comments_url":"https://api.github.com/repos/pzuraq/liquid-tether/issues/39/comments","events_url":"https://api.github.com/repos/pzuraq/liquid-tether/issues/39/events","html_url":"https://github.com/pzuraq/liquid-tether/issues/39","id":130027535,"number":39,"title":"component's size in modal on didInsertElement","user":{"login":"BenjaminHorn","id":5570232,"avatar_url":"https://avatars.githubusercontent.com/u/5570232?v=3","gravatar_id":"","url":"https://api.github.com/users/BenjaminHorn","html_url":"https://github.com/BenjaminHorn","followers_url":"https://api.github.com/users/BenjaminHorn/followers","following_url":"https://api.github.com/users/BenjaminHorn/following{/other_user}","gists_url":"https://api.github.com/users/BenjaminHorn/gists{/gist_id}","starred_url":"https://api.github.com/users/BenjaminHorn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BenjaminHorn/subscriptions","organizations_url":"https://api.github.com/users/BenjaminHorn/orgs","repos_url":"https://api.github.com/users/BenjaminHorn/repos","events_url":"https://api.github.com/users/BenjaminHorn/events{/privacy}","received_events_url":"https://api.github.com/users/BenjaminHorn/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":10,"created_at":"2016-01-30T19:35:37Z","updated_at":"2016-02-19T18:16:04Z","closed_at":null,"body":"I try to measure the width of a table on didInsertElement. Unfortunately it gives back a negative number. I guess the table is outside the window, and is not rendered properly at the moment when I try to get its width.\r\n\r\n```javascript\r\n   didInsertElement: function(){\r\n    console.log('table');\r\n    this.$('table').colResizable();\r\n    var widths = this.get('widths');\r\n    if (widths) {\r\n      this.setWidths(widths);\r\n    }\r\n\r\n  },\r\n  setWidths: function(widths) {\r\n    var width = 0, columns = 0, widths = widths.split(',');\r\n    this.$('table tr th').each(function(i, v){\r\n      columns++;\r\n      width += $(v).width();\r\n      console.log($(v));\r\n    });\r\n    // desperate attempt to fix it\r\n    if (width === 0) {\r\n      width = this.$('table').outerWidth();\r\n    }\r\n    console.log(width);\r\n    this.$('table tr th').each(function(i, v){\r\n      var w = (widths[i] * width) / 100;\r\n      $(v).width(w);\r\n\r\n    });    \r\n  },\r\n  didRender: function(){\r\n    console.log('didRender');\r\n    this.$('table').colResizable({disable: true});\r\n    this.$('table').colResizable();\r\n  },\r\n```\r\n\r\nIf I call setWidths from didRender, then it works fine, I just have to make my table component rerender after it has already appear in full size in the model. Just for test I do it by mouseclick, but I should find a way to do it automatically\r\n- when the animation is ended, and I have the final size of the table\r\n- only once, at the begging of the component's lifecycle \r\n\r\n"},"comment":{"url":"https://api.github.com/repos/pzuraq/liquid-tether/issues/comments/186343071","html_url":"https://github.com/pzuraq/liquid-tether/issues/39#issuecomment-186343071","issue_url":"https://api.github.com/repos/pzuraq/liquid-tether/issues/39","id":186343071,"user":{"login":"pzuraq","id":685518,"avatar_url":"https://avatars.githubusercontent.com/u/685518?v=3","gravatar_id":"","url":"https://api.github.com/users/pzuraq","html_url":"https://github.com/pzuraq","followers_url":"https://api.github.com/users/pzuraq/followers","following_url":"https://api.github.com/users/pzuraq/following{/other_user}","gists_url":"https://api.github.com/users/pzuraq/gists{/gist_id}","starred_url":"https://api.github.com/users/pzuraq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pzuraq/subscriptions","organizations_url":"https://api.github.com/users/pzuraq/orgs","repos_url":"https://api.github.com/users/pzuraq/repos","events_url":"https://api.github.com/users/pzuraq/events{/privacy}","received_events_url":"https://api.github.com/users/pzuraq/received_events","type":"User","site_admin":false},"created_at":"2016-02-19T18:16:04Z","updated_at":"2016-02-19T18:16:04Z","body":"Been super busy the past couple weeks, have a new project that I've been working on. I'll have some time this weekend and am planning to take a look and get to the bottom of this then.\r\n\r\nWill keep you posted, sorry about the delay!"}}