From 57fc8330f8900f1998b5c094c5105e6ead9d809d Mon Sep 17 00:00:00 2001 From: Pipi Date: Fri, 27 Sep 2013 13:57:01 +0800 Subject: [PATCH] #40 loadBatchRoute Sort --- .../metadata/controller/BatchEditorController | 6 + extjs-app/metadata/view/BatchRouteGrid | 11 +- extjs-app/metadata/view/BatchViewer | 443 +++++++++--------- 3 files changed, 247 insertions(+), 213 deletions(-) diff --git a/extjs-app/metadata/controller/BatchEditorController b/extjs-app/metadata/controller/BatchEditorController index 5fd8844c..874df13f 100644 --- a/extjs-app/metadata/controller/BatchEditorController +++ b/extjs-app/metadata/controller/BatchEditorController @@ -537,6 +537,9 @@ " Ext.Msg.alert(\"Success\", action.result.message);", "\t\tthat.getBatchRouteGrid().loadBatchRoute(that.getBatchForm().getRecord().data.id);", " that.getBatchViewer().down('form[itemId=batchRouteForm]').getForm().reset(true);", + " that.getBatchViewer().down('form[itemId=batchRouteForm]').getForm().setValues({", + " 'batch.id': that.getBatchForm().getRecord().data.id", + " });", " },", " failure: function(form,action) {", " console.log('Updating Failed!');", @@ -575,6 +578,9 @@ " Ext.Msg.alert(\"Success\", action.result.message);", " that.getBatchRouteGrid().loadBatchRoute(that.getBatchForm().getRecord().data.id);", " that.getBatchViewer().down('form[itemId=batchRouteForm]').getForm().reset(true);", + " that.getBatchViewer().down('form[itemId=batchRouteForm]').getForm().setValues({", + " 'batch.id': that.getBatchForm().getRecord().data.id", + " });", " },", " failure: function(form,action) {", " console.log('Deleting Failed!');", diff --git a/extjs-app/metadata/view/BatchRouteGrid b/extjs-app/metadata/view/BatchRouteGrid index 1d9aaa85..7fc45e18 100644 --- a/extjs-app/metadata/view/BatchRouteGrid +++ b/extjs-app/metadata/view/BatchRouteGrid @@ -229,11 +229,18 @@ ], "implHandler": [ "console.log(\"View-batchRouteGrid.loadBatchRoute\");", + "", "var store = this.getStore();", + "", "store.removeAll();", "store.load({", - " params:{'batch.id':batchId}", - "});" + " params:{'batch.id':batchId},", + " callback:function(records, operation, success){", + "\t\tstore.sort(store.sorters.items[0]);", + " }", + "});", + "", + "" ] }, "designerId": "5a5a9244-095f-4a4a-9b5c-a64e8ca4f17d" diff --git a/extjs-app/metadata/view/BatchViewer b/extjs-app/metadata/view/BatchViewer index e9be20dd..a27f3925 100644 --- a/extjs-app/metadata/view/BatchViewer +++ b/extjs-app/metadata/view/BatchViewer @@ -25,6 +25,7 @@ }, "codeClass": null, "userConfig": { + "bodyBorder": null, "layout|flex": null }, "designerId": "4062aa13-975b-4e68-be4c-50feb17bfca3", @@ -69,7 +70,7 @@ "masterInstanceId": "b362b6fc-0ca5-488c-b06e-c65b6e94eb7f" }, { - "type": "Ext.form.Panel", + "type": "Ext.form.FieldSet", "reference": { "name": "items", "type": "array" @@ -77,251 +78,271 @@ "codeClass": null, "userConfig": { "layout|flex": 1, - "container|align": "stretch", - "itemId": "batchRouteForm", - "layout": "vbox", - "bodyBorder": null, - "bodyPadding": 10, - "title": null, - "jsonSubmit": true + "border": 2, + "margin": 10, + "padding": null, + "autoScroll": true, + "layout": "fit", + "title": "BatchRouteDetail" }, - "designerId": "812031db-b79c-44aa-b1eb-e546f7953060", + "designerId": "0aeaa844-9f0c-4619-bc46-c455b70caee0", "cn": [ { - "type": "linkedinstance", + "type": "Ext.form.Panel", "reference": { "name": "items", "type": "array" }, "codeClass": null, "userConfig": { - "itemId": "batchRouteToolbar" + "container|align": "stretch", + "itemId": "batchRouteForm", + "layout": "vbox", + "bodyBorder": null, + "bodyPadding": 10, + "title": null, + "jsonSubmit": true }, - "designerId": "9bfce976-5645-4cba-bdd3-26a7c68fbbfd", - "masterInstanceId": "1d596850-54ca-4052-8a62-d0928dcdc887", + "designerId": "812031db-b79c-44aa-b1eb-e546f7953060", "cn": [ { - "type": "basiceventbinding", + "type": "linkedinstance", "reference": { - "name": "listeners", + "name": "items", "type": "array" }, "codeClass": null, "userConfig": { - "fn": "onBatchRouteToolbarRender", - "implHandler": [ - "component.down('button[itemId=commonReadBtn]').hide();" - ], - "name": "render", - "scope": "me" + "border": null, + "itemId": "batchRouteToolbar" }, - "designerId": "842749e9-3d36-4197-bbe9-e8e517f5c441" - } - ] - }, - { - "type": "Ext.form.field.Text", - "reference": { - "name": "items", - "type": "array" - }, - "codeClass": null, - "userConfig": { - "layout|anchor": "100%", - "fieldLabel": "Batch_id", - "name": "batch.id", - "readOnly": true - }, - "designerId": "985fe45d-73f7-402a-b2bf-6c125c563de5" - }, - { - "type": "Ext.form.field.Text", - "reference": { - "name": "items", - "type": "array" - }, - "codeClass": null, - "userConfig": { - "fieldLabel": "id", - "name": "id", - "readOnly": true - }, - "designerId": "37dd30c0-494a-436f-92c9-f0ee993e5fd9" - }, - { - "type": "Ext.form.field.Number", - "reference": { - "name": "items", - "type": "array" - }, - "codeClass": null, - "userConfig": { - "layout|anchor": "100%", - "fieldLabel": "sequence", - "name": "sequence", - "allowBlank": false - }, - "designerId": "74b5e6ca-b1fd-4c3a-a63a-fe2b8751704a" - }, - { - "type": "Ext.form.field.Text", - "reference": { - "name": "items", - "type": "array" - }, - "codeClass": null, - "userConfig": { - "layout|anchor": "100%", - "hidden": true, - "fieldLabel": "Operation_id", - "name": "operation.id", - "allowBlank": false - }, - "designerId": "4666eb08-d6c1-42e1-a05b-1d323c8bbf39" - }, - { - "type": "linkedinstance", - "reference": { - "name": "items", - "type": "array" - }, - "codeClass": null, - "userConfig": { - "dock": null, - "fieldLabel": "Operation_name", - "name": "operation.name" - }, - "designerId": "38a70ddb-a92f-481a-bda6-9fe6c715aff7", - "masterInstanceId": "a3ddccd5-2f8d-47d1-acf6-9c79556fc51d", - "cn": [ + "designerId": "9bfce976-5645-4cba-bdd3-26a7c68fbbfd", + "masterInstanceId": "1d596850-54ca-4052-8a62-d0928dcdc887", + "cn": [ + { + "type": "basiceventbinding", + "reference": { + "name": "listeners", + "type": "array" + }, + "codeClass": null, + "userConfig": { + "fn": "onBatchRouteToolbarRender", + "implHandler": [ + "component.down('button[itemId=commonReadBtn]').hide();" + ], + "name": "render", + "scope": "me" + }, + "designerId": "842749e9-3d36-4197-bbe9-e8e517f5c441" + } + ] + }, { - "type": "basiceventbinding", + "type": "Ext.form.field.Text", "reference": { - "name": "listeners", + "name": "items", "type": "array" }, "codeClass": null, "userConfig": { - "fn": "onCommonOperationComboSelect", - "implHandler": [ - "", - "combo.up().getForm().setValues({", - " 'operation.id': records[0].data['id'],", - " 'operation.title':records[0].data['title']", - "});" - ], - "name": "select", - "scope": "me" + "layout|anchor": "100%", + "fieldLabel": "Batch_id", + "name": "batch.id", + "readOnly": true }, - "designerId": "d08e2827-8223-4a8d-babc-a8404f149f16" - } - ] - }, - { - "type": "Ext.form.field.Text", - "reference": { - "name": "items", - "type": "array" - }, - "codeClass": null, - "userConfig": { - "layout|anchor": "100%", - "layout|flex": null, - "fieldLabel": "Operation_title", - "name": "operation.title", - "allowBlank": false - }, - "designerId": "b1ac4f77-0c39-4f6a-8099-c7f0088e576a" - }, - { - "type": "Ext.form.field.Text", - "reference": { - "name": "items", - "type": "array" - }, - "codeClass": null, - "userConfig": { - "layout|anchor": "100%", - "layout|flex": null, - "hidden": true, - "fieldLabel": "Workstation_id", - "name": "workstation.id", - "allowBlank": false - }, - "designerId": "4d7e544c-9bf2-4123-b1eb-f657f39dbfa4" - }, - { - "type": "linkedinstance", - "reference": { - "name": "items", - "type": "array" - }, - "codeClass": null, - "userConfig": { - "fieldLabel": "Workstation_name", - "labelStyle": null, - "labelWidth": null, - "name": "workstation.name", - "allowBlank": false - }, - "designerId": "0c86203a-ef68-4ef6-abe5-fde37df6f3a9", - "masterInstanceId": "741671be-e150-4fa0-b27e-7375ba263788", - "cn": [ + "designerId": "985fe45d-73f7-402a-b2bf-6c125c563de5" + }, { - "type": "basiceventbinding", + "type": "Ext.form.field.Text", "reference": { - "name": "listeners", + "name": "items", "type": "array" }, "codeClass": null, "userConfig": { - "fn": "onCommonWorkstationComboSelect", - "implHandler": [ - "", - "combo.up().getForm().setValues({", - " 'workstation.id': records[0].data['id'],", - " 'workstation.title':records[0].data['title']", - "});" + "fieldLabel": "id", + "name": "id", + "readOnly": true + }, + "designerId": "37dd30c0-494a-436f-92c9-f0ee993e5fd9" + }, + { + "type": "Ext.form.field.Number", + "reference": { + "name": "items", + "type": "array" + }, + "codeClass": null, + "userConfig": { + "layout|anchor": "100%", + "fieldLabel": "sequence", + "name": "sequence", + "allowBlank": false + }, + "designerId": "74b5e6ca-b1fd-4c3a-a63a-fe2b8751704a" + }, + { + "type": "Ext.form.field.Text", + "reference": { + "name": "items", + "type": "array" + }, + "codeClass": null, + "userConfig": { + "layout|anchor": "100%", + "hidden": true, + "fieldLabel": "Operation_id", + "name": "operation.id", + "allowBlank": false + }, + "designerId": "4666eb08-d6c1-42e1-a05b-1d323c8bbf39" + }, + { + "type": "linkedinstance", + "reference": { + "name": "items", + "type": "array" + }, + "codeClass": null, + "userConfig": { + "dock": null, + "fieldLabel": "Operation_name", + "name": "operation.name" + }, + "designerId": "38a70ddb-a92f-481a-bda6-9fe6c715aff7", + "masterInstanceId": "a3ddccd5-2f8d-47d1-acf6-9c79556fc51d", + "cn": [ + { + "type": "basiceventbinding", + "reference": { + "name": "listeners", + "type": "array" + }, + "codeClass": null, + "userConfig": { + "fn": "onCommonOperationComboSelect", + "implHandler": [ + "", + "combo.up().getForm().setValues({", + " 'operation.id': records[0].data['id'],", + " 'operation.title':records[0].data['title']", + "});" + ], + "name": "select", + "scope": "me" + }, + "designerId": "d08e2827-8223-4a8d-babc-a8404f149f16" + } + ] + }, + { + "type": "Ext.form.field.Text", + "reference": { + "name": "items", + "type": "array" + }, + "codeClass": null, + "userConfig": { + "layout|anchor": "100%", + "layout|flex": null, + "fieldLabel": "Operation_title", + "name": "operation.title", + "allowBlank": false + }, + "designerId": "b1ac4f77-0c39-4f6a-8099-c7f0088e576a" + }, + { + "type": "Ext.form.field.Text", + "reference": { + "name": "items", + "type": "array" + }, + "codeClass": null, + "userConfig": { + "layout|anchor": "100%", + "layout|flex": null, + "hidden": true, + "fieldLabel": "Workstation_id", + "name": "workstation.id", + "allowBlank": false + }, + "designerId": "4d7e544c-9bf2-4123-b1eb-f657f39dbfa4" + }, + { + "type": "linkedinstance", + "reference": { + "name": "items", + "type": "array" + }, + "codeClass": null, + "userConfig": { + "fieldLabel": "Workstation_name", + "labelStyle": null, + "labelWidth": null, + "name": "workstation.name", + "allowBlank": false + }, + "designerId": "0c86203a-ef68-4ef6-abe5-fde37df6f3a9", + "masterInstanceId": "741671be-e150-4fa0-b27e-7375ba263788", + "cn": [ + { + "type": "basiceventbinding", + "reference": { + "name": "listeners", + "type": "array" + }, + "codeClass": null, + "userConfig": { + "fn": "onCommonWorkstationComboSelect", + "implHandler": [ + "", + "combo.up().getForm().setValues({", + " 'workstation.id': records[0].data['id'],", + " 'workstation.title':records[0].data['title']", + "});" + ], + "name": "select", + "scope": "me" + }, + "designerId": "cb927550-cbb3-4175-9f52-f05a619bd509" + } + ] + }, + { + "type": "Ext.form.field.Text", + "reference": { + "name": "items", + "type": "array" + }, + "codeClass": null, + "userConfig": { + "layout|anchor": "100%", + "fieldLabel": "Workstation_title", + "name": "workstation.title" + }, + "designerId": "95edad71-6ce1-479e-90a1-b20d97ca767f" + }, + { + "type": "basicfunction", + "reference": { + "name": "items", + "type": "array" + }, + "codeClass": null, + "userConfig": { + "fn": "doDisplay", + "designer|params": [ + "record" ], - "name": "select", - "scope": "me" + "implHandler": [ + "console.log(\"View-batchRouteForm.doDisplay\");", + "this.loadRecord(record);" + ] }, - "designerId": "cb927550-cbb3-4175-9f52-f05a619bd509" + "designerId": "098e0931-c593-4734-bf70-193bce5eb6ab" } ] - }, - { - "type": "Ext.form.field.Text", - "reference": { - "name": "items", - "type": "array" - }, - "codeClass": null, - "userConfig": { - "layout|anchor": "100%", - "fieldLabel": "Workstation_title", - "name": "workstation.title" - }, - "designerId": "95edad71-6ce1-479e-90a1-b20d97ca767f" - }, - { - "type": "basicfunction", - "reference": { - "name": "items", - "type": "array" - }, - "codeClass": null, - "userConfig": { - "fn": "doDisplay", - "designer|params": [ - "record" - ], - "implHandler": [ - "console.log(\"View-batchRouteForm.doDisplay\");", - "this.loadRecord(record);" - ] - }, - "designerId": "098e0931-c593-4734-bf70-193bce5eb6ab" } ] }