From a5f47492857a175548beff07cfb565129f687ae2 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Tue, 28 Apr 2015 22:41:07 +1200 Subject: Implement API to create devices --- web/DeviceView.js | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) (limited to 'web') diff --git a/web/DeviceView.js b/web/DeviceView.js index 4414b67ea..06cec7779 100644 --- a/web/DeviceView.js +++ b/web/DeviceView.js @@ -21,7 +21,22 @@ Ext.define('DeviceView', { title: Strings.device_title, tbar: [{ - text:'Add' + text:'Add', + handler: function() { + + var device = { + name: "AjaxTest", + uniqueId: "UniqueId" + }; + + Ext.Ajax.request({ + url: '/api/device/add', + jsonData: Ext.encode(device), + success: function() { + alert("success"); + } + }); + } }, { text:'Edit' }, { @@ -56,14 +71,14 @@ Ext.define('DeviceView', { fields:[ 'id', 'name', - 'unique_id', - 'position_id', - 'data_id' + 'uniqueId', + 'positionId', + 'dataId' ] }, columns: [ { text: Strings.device_name, dataIndex: 'name', flex: 1 }, - { text: Strings.device_identifier, dataIndex: 'unique_id', flex: 1 } + { text: Strings.device_identifier, dataIndex: 'uniqueId', flex: 1 } ] }); -- cgit v1.2.3