{"action":"created","issue":{"url":"https://api.github.com/repos/geoext/geoext3/issues/37","labels_url":"https://api.github.com/repos/geoext/geoext3/issues/37/labels{/name}","comments_url":"https://api.github.com/repos/geoext/geoext3/issues/37/comments","events_url":"https://api.github.com/repos/geoext/geoext3/issues/37/events","html_url":"https://github.com/geoext/geoext3/pull/37","id":95455220,"number":37,"title":"reversing the way we add layers in treestore","user":{"login":"weskamm","id":1381363,"avatar_url":"https://avatars.githubusercontent.com/u/1381363?v=3","gravatar_id":"","url":"https://api.github.com/users/weskamm","html_url":"https://github.com/weskamm","followers_url":"https://api.github.com/users/weskamm/followers","following_url":"https://api.github.com/users/weskamm/following{/other_user}","gists_url":"https://api.github.com/users/weskamm/gists{/gist_id}","starred_url":"https://api.github.com/users/weskamm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/weskamm/subscriptions","organizations_url":"https://api.github.com/users/weskamm/orgs","repos_url":"https://api.github.com/users/weskamm/repos","events_url":"https://api.github.com/users/weskamm/events{/privacy}","received_events_url":"https://api.github.com/users/weskamm/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-07-16T15:10:45Z","updated_at":"2015-07-17T09:33:59Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/geoext/geoext3/pulls/37","html_url":"https://github.com/geoext/geoext3/pull/37","diff_url":"https://github.com/geoext/geoext3/pull/37.diff","patch_url":"https://github.com/geoext/geoext3/pull/37.patch"},"body":"Ok, this PR needs a little explanation:\r\nI reversed the order the layers get added in the treestore.\r\nThe background is the following: The ol3-layer-collection contains the layers in the order they have been added.\r\nIf you add a layer at runtime to the map, it will get appended to the end of the collection / array.\r\nIn order to show this newly added layer on top in a layertree, you will need to reverse the collection.\r\nI solved this by using 'Ext.each' with the 'reverse' flag set to true, so the code does the same as before but just in the reversed order.\r\nThis way the layertree shows the first / oldest added layers at the bottom, the newly or later added laters get shown on top.\r\n\r\nHave a look at the layertree example to see the current problem:\r\nhttp://rawgit.com/geoext/geoext3/master/examples/tree/panel.html\r\n\r\nThe layer at the bottom gets shown on top of the map.\r\nI suspect this is exactly the wrong behaviour and this fix addresses this issue."},"comment":{"url":"https://api.github.com/repos/geoext/geoext3/issues/comments/122228948","html_url":"https://github.com/geoext/geoext3/pull/37#issuecomment-122228948","issue_url":"https://api.github.com/repos/geoext/geoext3/issues/37","id":122228948,"user":{"login":"chrismayer","id":1185547,"avatar_url":"https://avatars.githubusercontent.com/u/1185547?v=3","gravatar_id":"","url":"https://api.github.com/users/chrismayer","html_url":"https://github.com/chrismayer","followers_url":"https://api.github.com/users/chrismayer/followers","following_url":"https://api.github.com/users/chrismayer/following{/other_user}","gists_url":"https://api.github.com/users/chrismayer/gists{/gist_id}","starred_url":"https://api.github.com/users/chrismayer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrismayer/subscriptions","organizations_url":"https://api.github.com/users/chrismayer/orgs","repos_url":"https://api.github.com/users/chrismayer/repos","events_url":"https://api.github.com/users/chrismayer/events{/privacy}","received_events_url":"https://api.github.com/users/chrismayer/received_events","type":"User","site_admin":false},"created_at":"2015-07-17T09:33:59Z","updated_at":"2015-07-17T09:33:59Z","body":"Cool @weskamm :+1: \r\nBTW, I also meant that the default is the behavior described by you above. Maybe ``false`` was a bit misleading. So all good, please merge if you want."}}