From: Gil Moskowitz Date: Wed, 11 Jun 2014 13:59:22 +0000 (-0400) Subject: issue #23796 - first pass exports the parent record, not the attr in the gridbox X-Git-Tag: v4.5.0-r1590-3~1^2~9^2~5 X-Git-Url: http://git.roojs.org/?a=commitdiff_plain;h=56484821dbba43955b8abbc0e981e403d90f1be3;p=xtuple issue #23796 - first pass exports the parent record, not the attr in the gridbox --- diff --git a/lib/enyo-x/source/views/grid_box.js b/lib/enyo-x/source/views/grid_box.js index 35b9ab96e..de85aa9f3 100644 --- a/lib/enyo-x/source/views/grid_box.js +++ b/lib/enyo-x/source/views/grid_box.js @@ -239,7 +239,8 @@ trailing:true, white:true, strict: false*/ kind: "XV.Groupbox", classes: "panel xv-grid-box", events: { - onChildWorkspace: "" + onChildWorkspace: "", + onExportAttr: "" }, handlers: { ontap: "buttonTapped", @@ -345,13 +346,13 @@ trailing:true, white:true, strict: false*/ ]} ); - // "New" button components.push({ kind: "FittableColumns", name: "navigationButtonPanel", classes: "xv-buttons", components: [ - {kind: "onyx.Button", name: "newButton", onclick: "newItem", classes: "icon-plus"} + {kind: "onyx.Button", name: "newButton", onclick: "newItem", classes: "icon-plus"}, + {kind: "font.TextIcon", name: "exportButton", onclick: "exportAttr", icon: "share", content: "_export".loc()} // TODO: classes? ] }); @@ -527,6 +528,12 @@ trailing:true, white:true, strict: false*/ editor.render(); editor.setFirstFocus(); }, + exportAttr: function(inSender, inEvent) { + var gridbox = inEvent.originator.parent.parent.parent; + this.doExportAttr({ recordType: gridbox.parent.parent.model, + uuid: gridbox.parent.parent.value.attributes.uuid, + attr: gridbox.attr }); + }, refreshLists: function () { this.$.aboveGridList.refresh(); this.$.belowGridList.refresh(); diff --git a/lib/enyo-x/source/views/workspace.js b/lib/enyo-x/source/views/workspace.js index a913e9fdf..93a9684e6 100644 --- a/lib/enyo-x/source/views/workspace.js +++ b/lib/enyo-x/source/views/workspace.js @@ -656,7 +656,8 @@ trailing:true, white:true, strict: false*/ onReport: "report", onStatusChange: "statusChanged", onTitleChange: "titleChanged", - onSaveTextChange: "saveTextChanged" + onSaveTextChange: "saveTextChanged", + onExportAttr: "exportAttr" }, components: [ {kind: "FittableRows", name: "navigationPanel", classes: "xv-menu-container", components: [ @@ -1052,6 +1053,29 @@ trailing:true, white:true, strict: false*/ saveTextChanged: function (inSender, inEvent) { this.$.saveButton.setContent(inEvent.content); }, + + exportAttr: function (inSender, inEvent) { + this.openExportTab('export', inEvent.recordType, inEvent.uuid, inEvent.attr); + return true; + }, + + // export the data for just one attr of the model displayed by the workspace + openExportTab: function (routeName, recordType, id, attr) { + console.log('workspace exportAttr ' + recordType + '/' + attr + '(' + id + ')'); + var query = { parameters: [{ attribute: "uuid", value: id }] }; + // TODO: limit the data treated to just attribute: attr + + // sending the locale information back over the wire saves a call to the db + window.open(XT.getOrganizationPath() + + '/%@?details={"nameSpace":"%@","type":"%@","query":%@,"culture":%@,"print":%@}' + .f(routeName, + recordType.prefix(), + recordType.suffix(), + JSON.stringify(query), + JSON.stringify(XT.locale.culture), + "false"), + '_newtab'); + }, /** This is called for each row in the menu List. The menu text is derived from the corresponding panel index.