{"action":"created","issue":{"url":"https://api.github.com/repos/haltu/muuri/issues/168","repository_url":"https://api.github.com/repos/haltu/muuri","labels_url":"https://api.github.com/repos/haltu/muuri/issues/168/labels{/name}","comments_url":"https://api.github.com/repos/haltu/muuri/issues/168/comments","events_url":"https://api.github.com/repos/haltu/muuri/issues/168/events","html_url":"https://github.com/haltu/muuri/issues/168","id":323840244,"number":168,"title":"Sorting & Saving","user":{"login":"lithiumhax","id":9411464,"avatar_url":"https://avatars3.githubusercontent.com/u/9411464?v=4","gravatar_id":"","url":"https://api.github.com/users/lithiumhax","html_url":"https://github.com/lithiumhax","followers_url":"https://api.github.com/users/lithiumhax/followers","following_url":"https://api.github.com/users/lithiumhax/following{/other_user}","gists_url":"https://api.github.com/users/lithiumhax/gists{/gist_id}","starred_url":"https://api.github.com/users/lithiumhax/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lithiumhax/subscriptions","organizations_url":"https://api.github.com/users/lithiumhax/orgs","repos_url":"https://api.github.com/users/lithiumhax/repos","events_url":"https://api.github.com/users/lithiumhax/events{/privacy}","received_events_url":"https://api.github.com/users/lithiumhax/received_events","type":"User","site_admin":false},"labels":[{"id":302140473,"url":"https://api.github.com/repos/haltu/muuri/labels/question","name":"question","color":"cc317c","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2018-05-17T01:21:38Z","updated_at":"2018-05-20T21:32:36Z","closed_at":null,"author_association":"NONE","body":"I'm trying to sort my items, but I'm having problems getting it to work.\r\nUsing the examples shown using:\r\n\r\n`var order = grid.getItems().map(item => item.getElement().getAttribute('data-id'))`\r\n\r\nI get `[1,2,3,4]`\r\n\r\nIf I move some items around I get `[4,2,1,3]`\r\n\r\nSo that seems to be working ok.\r\n\r\nI re-load my items back into the grid, but the order is the normal `[1,2,3,4]` order.  \r\nI'm able to re-load the _order_ array from _localstorage_, but I'm not sure what I'm supposed to do with that array to re-sort the items back to their proper positions.\r\n\r\nCould you explain a bit more on **sortData** and **grid.sort** and how I am to use them with my saved layout array.\r\n\r\nThank-you!\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/haltu/muuri/issues/comments/390514464","html_url":"https://github.com/haltu/muuri/issues/168#issuecomment-390514464","issue_url":"https://api.github.com/repos/haltu/muuri/issues/168","id":390514464,"user":{"login":"niklasramo","id":3194553,"avatar_url":"https://avatars1.githubusercontent.com/u/3194553?v=4","gravatar_id":"","url":"https://api.github.com/users/niklasramo","html_url":"https://github.com/niklasramo","followers_url":"https://api.github.com/users/niklasramo/followers","following_url":"https://api.github.com/users/niklasramo/following{/other_user}","gists_url":"https://api.github.com/users/niklasramo/gists{/gist_id}","starred_url":"https://api.github.com/users/niklasramo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/niklasramo/subscriptions","organizations_url":"https://api.github.com/users/niklasramo/orgs","repos_url":"https://api.github.com/users/niklasramo/repos","events_url":"https://api.github.com/users/niklasramo/events{/privacy}","received_events_url":"https://api.github.com/users/niklasramo/received_events","type":"User","site_admin":false},"created_at":"2018-05-20T21:32:36Z","updated_at":"2018-05-20T21:32:36Z","author_association":"COLLABORATOR","body":"Although not recommended, you can also just directly sort grid._items array (mutate it) and call grid.layout() after it. Get's the job done also, pretty efficiently."}}
{"actor":{"display_login":"niklasramo"}}