{"action":"created","issue":{"url":"https://api.github.com/repos/vitmalina/w2ui/issues/1276","repository_url":"https://api.github.com/repos/vitmalina/w2ui","labels_url":"https://api.github.com/repos/vitmalina/w2ui/issues/1276/labels{/name}","comments_url":"https://api.github.com/repos/vitmalina/w2ui/issues/1276/comments","events_url":"https://api.github.com/repos/vitmalina/w2ui/issues/1276/events","html_url":"https://github.com/vitmalina/w2ui/issues/1276","id":162015841,"number":1276,"title":"w2ui Grid \"set\" method using .extend which does an object merge instead of a replace","user":{"login":"sjmosdef","id":20116594,"avatar_url":"https://avatars.githubusercontent.com/u/20116594?v=3","gravatar_id":"","url":"https://api.github.com/users/sjmosdef","html_url":"https://github.com/sjmosdef","followers_url":"https://api.github.com/users/sjmosdef/followers","following_url":"https://api.github.com/users/sjmosdef/following{/other_user}","gists_url":"https://api.github.com/users/sjmosdef/gists{/gist_id}","starred_url":"https://api.github.com/users/sjmosdef/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sjmosdef/subscriptions","organizations_url":"https://api.github.com/users/sjmosdef/orgs","repos_url":"https://api.github.com/users/sjmosdef/repos","events_url":"https://api.github.com/users/sjmosdef/events{/privacy}","received_events_url":"https://api.github.com/users/sjmosdef/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-06-23T20:29:36Z","updated_at":"2016-06-23T21:33:07Z","closed_at":null,"body":"I have a fairly complex JSON object representing a row in the grid. In that row object there is a list of objects (we'll call it array) which can change based on the state of the row. If the array length starts out at 3, is updated to 6, and then attempted to be updated back to 3. The grid \"set\" method will leave all distinct objects in memory because instead of overwriting the object it's using .extend which does an object merge effectively unioning the arrays. This drove me insane for a few hours. Why use .extend instead of just updating the data? Is my object too complex to be \"kept in the grid\"?\r\n\r\nCurrent:\r\nif (isSummary) {\r\n    $.extend(true, this.summary[ind], record);\r\n} else {\r\n    $.extend(true, this.records[ind], record);\r\n}\r\n\r\nProposed:\r\nif (isSummary) {\r\n    this.summary[ind] = record;\r\n} else {\r\n    this.records[ind] = record;\r\n}"},"comment":{"url":"https://api.github.com/repos/vitmalina/w2ui/issues/comments/228190921","html_url":"https://github.com/vitmalina/w2ui/issues/1276#issuecomment-228190921","issue_url":"https://api.github.com/repos/vitmalina/w2ui/issues/1276","id":228190921,"user":{"login":"mpf82","id":10152404,"avatar_url":"https://avatars.githubusercontent.com/u/10152404?v=3","gravatar_id":"","url":"https://api.github.com/users/mpf82","html_url":"https://github.com/mpf82","followers_url":"https://api.github.com/users/mpf82/followers","following_url":"https://api.github.com/users/mpf82/following{/other_user}","gists_url":"https://api.github.com/users/mpf82/gists{/gist_id}","starred_url":"https://api.github.com/users/mpf82/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mpf82/subscriptions","organizations_url":"https://api.github.com/users/mpf82/orgs","repos_url":"https://api.github.com/users/mpf82/repos","events_url":"https://api.github.com/users/mpf82/events{/privacy}","received_events_url":"https://api.github.com/users/mpf82/received_events","type":"User","site_admin":false},"created_at":"2016-06-23T21:33:07Z","updated_at":"2016-06-23T21:33:07Z","body":"[The documentation](http://w2ui.com/web/docs/w2grid.set) of `w2grid.set` clearly states that the record is extended.\r\n\r\nWhy don't you just update the record directly and refresh the grid?\r\n\r\n    grid.record[index] = new_record;\r\n    grid.refresh();\r\n"}}
{"actor":{"display_login":"mpf82"}}