{"action":"created","issue":{"url":"https://api.github.com/repos/vitalidze/traccar-web/issues/96","labels_url":"https://api.github.com/repos/vitalidze/traccar-web/issues/96/labels{/name}","comments_url":"https://api.github.com/repos/vitalidze/traccar-web/issues/96/comments","events_url":"https://api.github.com/repos/vitalidze/traccar-web/issues/96/events","html_url":"https://github.com/vitalidze/traccar-web/issues/96","id":58780601,"number":96,"title":"Update device table column","user":{"login":"Jeferex","id":3135479,"avatar_url":"https://avatars.githubusercontent.com/u/3135479?v=3","gravatar_id":"","url":"https://api.github.com/users/Jeferex","html_url":"https://github.com/Jeferex","followers_url":"https://api.github.com/users/Jeferex/followers","following_url":"https://api.github.com/users/Jeferex/following{/other_user}","gists_url":"https://api.github.com/users/Jeferex/gists{/gist_id}","starred_url":"https://api.github.com/users/Jeferex/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Jeferex/subscriptions","organizations_url":"https://api.github.com/users/Jeferex/orgs","repos_url":"https://api.github.com/users/Jeferex/repos","events_url":"https://api.github.com/users/Jeferex/events{/privacy}","received_events_url":"https://api.github.com/users/Jeferex/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/vitalidze/traccar-web/labels/help%20wanted","name":"help wanted","color":"159818"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-02-24T18:16:21Z","updated_at":"2015-02-25T15:17:19Z","closed_at":null,"body":"I've added a boolean column in devices table. I've followed your implementation of FOLLOW and RECORD TRACE checkboxes but I see you don't save those values in database. I want to save it, though.\r\n\r\nHow can I do to just update the column. I am stuck in device controller. I've tried this but it doesn't work.\r\n\r\n```java\r\ndeviceStore.addStoreRecordChangeHandler(new StoreRecordChangeEvent.StoreRecordChangeHandler<Device>() {\r\n            @Override\r\n            public void onRecordChange(StoreRecordChangeEvent<Device> event) {\r\n                if (event.getProperty().getPath().equals(\"stop\")) {\r\n                    Device device = event.getRecord().getModel();\r\n                \tApplication.getDataService().updateDevice(device, new BaseAsyncCallback<Device>() {\r\n                        @Override\r\n                        public void onSuccess(Device result) {\r\n                            deviceStore.update(result);\r\n                        }\r\n                    });\r\n                }\r\n            }\r\n        });\r\n```\r\n\r\nAny hints?"},"comment":{"url":"https://api.github.com/repos/vitalidze/traccar-web/issues/comments/75977800","html_url":"https://github.com/vitalidze/traccar-web/issues/96#issuecomment-75977800","issue_url":"https://api.github.com/repos/vitalidze/traccar-web/issues/96","id":75977800,"user":{"login":"Jeferex","id":3135479,"avatar_url":"https://avatars.githubusercontent.com/u/3135479?v=3","gravatar_id":"","url":"https://api.github.com/users/Jeferex","html_url":"https://github.com/Jeferex","followers_url":"https://api.github.com/users/Jeferex/followers","following_url":"https://api.github.com/users/Jeferex/following{/other_user}","gists_url":"https://api.github.com/users/Jeferex/gists{/gist_id}","starred_url":"https://api.github.com/users/Jeferex/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Jeferex/subscriptions","organizations_url":"https://api.github.com/users/Jeferex/orgs","repos_url":"https://api.github.com/users/Jeferex/repos","events_url":"https://api.github.com/users/Jeferex/events{/privacy}","received_events_url":"https://api.github.com/users/Jeferex/received_events","type":"User","site_admin":false},"created_at":"2015-02-25T15:17:19Z","updated_at":"2015-02-25T15:17:19Z","body":"This is what I've done:\r\n\r\nin DeviceController.java\r\n\r\n```\r\npublic DeviceController(DeviceHandler deviceHandler, DeviceView.SettingsHandler settingsHandler) {\r\n        this.deviceHandler = deviceHandler;\r\n        DeviceProperties deviceProperties = GWT.create(DeviceProperties.class);\r\n        deviceStore = new ListStore<Device>(deviceProperties.id());\r\n        deviceStore.addStoreRecordChangeHandler(new StoreRecordChangeEvent.StoreRecordChangeHandler<Device>() {\r\n            @Override\r\n            public void onRecordChange(StoreRecordChangeEvent<Device> event) {\r\n                if (event.getProperty().getPath().equals(\"stop\")) {\r\n                    Device device = event.getRecord().getModel();\r\n                \tApplication.getDataService().stopDevice(device, new BaseAsyncCallback<Device>() {\r\n                        @Override\r\n                        public void onSuccess(Device result) {\r\n                            deviceStore.update(result);\r\n                        }\r\n                    });\r\n                }\r\n            }\r\n        });\r\n        deviceView = new DeviceView(this, settingsHandler, deviceStore);\r\n    }\r\n```\r\n\r\nin DataServiceImpl.java\r\n\r\n```\r\n@Override\r\n    public Device stopDevice(Device device) {\r\n        EntityManager entityManager = getSessionEntityManager();\r\n        entityManager.getTransaction().begin();\r\n        try {\r\n\t        Device tmp_device = entityManager.find(Device.class, device.getId());\r\n\t        tmp_device.setStop(device.getStop());\r\n\t        entityManager.getTransaction().commit();\r\n\t        return tmp_device;\r\n        } catch (RuntimeException e) {\r\n            entityManager.getTransaction().rollback();\r\n            throw e;\r\n        }\r\n    }\r\n```\r\n\r\nIn DeviceView.java\r\n\r\n```\r\nColumnConfig<Device, Boolean> colStop = new ColumnConfig<Device, Boolean>(deviceProperties.stop(), 60, \"APAGAR\");\r\n        \r\n        colStop.setCell(new CheckBoxCell());\r\n        colStop.setFixed(true);\r\n        colStop.setResizable(false);\r\n        columnConfigList.add(colStop);\r\n        \r\n        columnModel = new ColumnModel<Device>(columnConfigList);\r\n\r\n        uiBinder.createAndBindUi(this);\r\n\r\n        grid.getSelectionModel().addSelectionChangedHandler(this);\r\n        grid.getSelectionModel().setSelectionMode(SelectionMode.SINGLE);\r\n        \r\n        GridEditing<Device> editing = new GridInlineEditing<Device>(grid);\r\n        grid.getView().setShowDirtyCells(false);\r\n        editing.addEditor(colStop, new CheckBox());\r\n```\r\n\r\nBut everytime I check the checkbox, It unchecks right away."}}