{"action":"created","issue":{"url":"https://api.github.com/repos/WebCabin/wcDocker/issues/90","repository_url":"https://api.github.com/repos/WebCabin/wcDocker","labels_url":"https://api.github.com/repos/WebCabin/wcDocker/issues/90/labels{/name}","comments_url":"https://api.github.com/repos/WebCabin/wcDocker/issues/90/comments","events_url":"https://api.github.com/repos/WebCabin/wcDocker/issues/90/events","html_url":"https://github.com/WebCabin/wcDocker/issues/90","id":135682319,"number":90,"title":"Restore layout and rebuild content","user":{"login":"lomotelsch","id":17064071,"avatar_url":"https://avatars.githubusercontent.com/u/17064071?v=3","gravatar_id":"","url":"https://api.github.com/users/lomotelsch","html_url":"https://github.com/lomotelsch","followers_url":"https://api.github.com/users/lomotelsch/followers","following_url":"https://api.github.com/users/lomotelsch/following{/other_user}","gists_url":"https://api.github.com/users/lomotelsch/gists{/gist_id}","starred_url":"https://api.github.com/users/lomotelsch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lomotelsch/subscriptions","organizations_url":"https://api.github.com/users/lomotelsch/orgs","repos_url":"https://api.github.com/users/lomotelsch/repos","events_url":"https://api.github.com/users/lomotelsch/events{/privacy}","received_events_url":"https://api.github.com/users/lomotelsch/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-02-23T09:27:21Z","updated_at":"2016-02-23T14:08:27Z","closed_at":"2016-02-23T14:08:27Z","body":"Hi Jeff,\r\n\r\nI need to save and restore layouts.\r\nTherefore I need to restore every panel-content after restoring the layout since all panels got destroyed and recreated using wcDocker.restore(layout).\r\n\r\nMaybe I misunderstand the concept of registering and adding panels, so let´s recap:\r\n(I basically used your tutorial at http://docker.api.webcabin.org/tutorial-1.0-getting-started.html)\r\n\r\n**wcDocker.registerPanelType** is for telling wcDocker what kind of (useable) panels exist.\r\nLet´s call one panelType \"_Main-Panel_\" (which will have the limit-flag set to 1) and another one \"_Child-Panel_\" (which can be added in an unlimited amount):\r\n```\r\nmyDocker.registerPanelType('Main-Panel', {});\r\nmyDocker.registerPanelType('Child-Panel', {});\r\n```\r\n\r\n**wcDocker.addPanel** is for creating single panel-instances using the panel-types we recently created:\r\n```\r\nvar mainPanel = myDocker.addPanel('Main-Panel', wcDocker.DOCK.LEFT);\r\nvar childPanel1 = myDocker.addPanel('Child-Panel', wcDocker.DOCK.RIGHT);\r\nvar childPanel2 = myDocker.addPanel('Child-Panel', wcDocker.DOCK.RIGHT);\r\n...\r\n```\r\n\r\nSubsequently I´ll add content to the panels:\r\n```\r\nmainPanel.layout().addItem($('<div>Main-Panel</div>'));\r\nchildPanel1.layout().addItem($('<div>Child-Panel 1</div>'));\r\nchildPanel2.layout().addItem($('<div>Child-Panel 2</div>'));\r\n...\r\n```\r\n\r\nI know that for adding/creating panel-content I´ll could use the panel´s onCreate-method while registering the panel, but I want different content for every Child-Panel, so this concept of creating panel-content bound to a panel-type is misleading to me:\r\n```\r\nmyDocker.registerPanelType('Child-Panel', {\r\n  onCreate: function(myPanel, options) {\r\n    myPanel.layout().addItem($('<div>Child-Panel with always the same content</div>'));\r\n  }\r\n});\r\n```\r\n\r\nRestoring a previously saved layout leads me to the question on how to restore every´s panel´s content, since a dynamically created panel-instance does not have a pointer to it´s (also dynamically created) content, expect by creating content using the onCreate-method while registering a panel-type - which is to static for my (dynamic) needs.\r\n\r\nDo you have a proposal on how to walk on?\r\n\r\nSebastian"},"comment":{"url":"https://api.github.com/repos/WebCabin/wcDocker/issues/comments/187713237","html_url":"https://github.com/WebCabin/wcDocker/issues/90#issuecomment-187713237","issue_url":"https://api.github.com/repos/WebCabin/wcDocker/issues/90","id":187713237,"user":{"login":"lomotelsch","id":17064071,"avatar_url":"https://avatars.githubusercontent.com/u/17064071?v=3","gravatar_id":"","url":"https://api.github.com/users/lomotelsch","html_url":"https://github.com/lomotelsch","followers_url":"https://api.github.com/users/lomotelsch/followers","following_url":"https://api.github.com/users/lomotelsch/following{/other_user}","gists_url":"https://api.github.com/users/lomotelsch/gists{/gist_id}","starred_url":"https://api.github.com/users/lomotelsch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lomotelsch/subscriptions","organizations_url":"https://api.github.com/users/lomotelsch/orgs","repos_url":"https://api.github.com/users/lomotelsch/repos","events_url":"https://api.github.com/users/lomotelsch/events{/privacy}","received_events_url":"https://api.github.com/users/lomotelsch/received_events","type":"User","site_admin":false},"created_at":"2016-02-23T14:08:27Z","updated_at":"2016-02-23T14:08:27Z","body":"ok, got it ...\r\ntrying now to wrap wcDocker with some content-restore-logic..\r\nThank you!"}}