{"action":"created","issue":{"url":"https://api.github.com/repos/bogdan/datagrid/issues/188","repository_url":"https://api.github.com/repos/bogdan/datagrid","labels_url":"https://api.github.com/repos/bogdan/datagrid/issues/188/labels{/name}","comments_url":"https://api.github.com/repos/bogdan/datagrid/issues/188/comments","events_url":"https://api.github.com/repos/bogdan/datagrid/issues/188/events","html_url":"https://github.com/bogdan/datagrid/issues/188","id":172856231,"number":188,"title":"Default Sort Order Overrides Sort Order of Parent Object's Field","user":{"login":"PirunSeng","id":12696293,"avatar_url":"https://avatars.githubusercontent.com/u/12696293?v=3","gravatar_id":"","url":"https://api.github.com/users/PirunSeng","html_url":"https://github.com/PirunSeng","followers_url":"https://api.github.com/users/PirunSeng/followers","following_url":"https://api.github.com/users/PirunSeng/following{/other_user}","gists_url":"https://api.github.com/users/PirunSeng/gists{/gist_id}","starred_url":"https://api.github.com/users/PirunSeng/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PirunSeng/subscriptions","organizations_url":"https://api.github.com/users/PirunSeng/orgs","repos_url":"https://api.github.com/users/PirunSeng/repos","events_url":"https://api.github.com/users/PirunSeng/events{/privacy}","received_events_url":"https://api.github.com/users/PirunSeng/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-08-24T03:23:41Z","updated_at":"2016-08-24T06:33:50Z","closed_at":null,"body":"Hi,\r\nDatagrid is awesome. My current Rails app is almost all about datagrid.\r\n\r\nCurrently, I've added some fields of parent object into its children datagrid table. The sort order of the parent's field is overridden by the default sort order of the original grid.\r\n\r\nI have two models as the following.\r\n\r\n```\r\nClient belongs to User\r\nUser has many clients\r\n```\r\n\r\nMy ClientGrid class:\r\n\r\n```\r\nscope do\r\n     Client.includes(:user).order('clients.status, clients.first_name')\r\nend\r\n\r\ncolumn(:user, header: 'User' , order: proc { |scope| scope.joins(:user).order('users.first_name') }) do |object|\r\n     object.user.first_name\r\nend\r\n```\r\n\r\nWhen the grid is first rendered, it sorts the data by client status then first name as default correctly. However, when I try sorting the user column, it doesn't work, but when I try removing the default sort order, the user column sort order works well as expected.\r\n\r\nAre you getting my point?\r\nHope you can help.\r\nThanks,"},"comment":{"url":"https://api.github.com/repos/bogdan/datagrid/issues/comments/241970426","html_url":"https://github.com/bogdan/datagrid/issues/188#issuecomment-241970426","issue_url":"https://api.github.com/repos/bogdan/datagrid/issues/188","id":241970426,"user":{"login":"PirunSeng","id":12696293,"avatar_url":"https://avatars.githubusercontent.com/u/12696293?v=3","gravatar_id":"","url":"https://api.github.com/users/PirunSeng","html_url":"https://github.com/PirunSeng","followers_url":"https://api.github.com/users/PirunSeng/followers","following_url":"https://api.github.com/users/PirunSeng/following{/other_user}","gists_url":"https://api.github.com/users/PirunSeng/gists{/gist_id}","starred_url":"https://api.github.com/users/PirunSeng/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PirunSeng/subscriptions","organizations_url":"https://api.github.com/users/PirunSeng/orgs","repos_url":"https://api.github.com/users/PirunSeng/repos","events_url":"https://api.github.com/users/PirunSeng/events{/privacy}","received_events_url":"https://api.github.com/users/PirunSeng/received_events","type":"User","site_admin":false},"created_at":"2016-08-24T06:33:50Z","updated_at":"2016-08-24T06:33:50Z","body":"Thanks so much @bogdan for quick response and a very helpful answer one!\r\nIt works like a charm by changing `order` to `reorder` inside the column's `:order` as you guided.\r\nI've never noticed this behavior of AR."}}
{"actor":{"display_login":"PirunSeng"}}