Skip to content

Commit

Permalink
Merge pull request #12 from mendix/feature/optional_save
Browse files Browse the repository at this point in the history
Make saving the context object optional
  • Loading branch information
JelteMX authored Sep 5, 2017
2 parents 8564a14 + 072d49f commit 61627e3
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 5 deletions.
7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
{
"name": "LabelSelect",
"version": "4.4.1",
"version": "4.5.0",
"description": "With this widget you can easily create/assign/remove objects (for example labels) to/from an object.",
"license": "Apache-2",
"author": "",
"private": true,
"dependencies": {
},
"dependencies": {},
"devDependencies": {
"del": "^2.2.2",
"gulp": "^3.9.1",
Expand Down Expand Up @@ -36,4 +35,4 @@
"folders": "node ./node_modules/gulp/bin/gulp folders",
"modeler": "node ./node_modules/gulp/bin/gulp modeler"
}
}
}
5 changes: 5 additions & 0 deletions src/LabelSelect/LabelSelect.xml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@
<category>Behavior</category>
<description>The minimum length that should be entered before autocomplete starts.</description>
</property>
<property key="saveOnAddTag" type="boolean" defaultValue="true">
<caption>Save context on adding tags</caption>
<category>Behavior</category>
<description>Save/commit context object on adding a tag. If you want to save this object yourself (for example on new objects), set this to No.</description>
</property>
<property key="aftercreatemf" type="microflow" required="false">
<caption>After create label</caption>
<category>Interaction</category>
Expand Down
7 changes: 7 additions & 0 deletions src/LabelSelect/widget/LabelSelect.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ define([
return declare("LabelSelect.widget.LabelSelect", [_WidgetBase, _TemplatedMixin], {
templateString: widgetTemplate,

// Set in modeler
saveOnAddTag: true,

_handles: null,
_contextObj: null,
_listBox: null,
Expand Down Expand Up @@ -269,6 +272,10 @@ define([
},

_saveObject: function() {
if (!this.saveOnAddTag) {
logger.debug(this.id + "._saveObject skipped, save on add tags disabled");
return;
}
logger.debug(this.id + "._saveObject");
var method = (!mx.version || mx.version && parseInt(mx.version.split(".")[0]) < 7) ? "save" : "commit";
mx.data[method]({
Expand Down
2 changes: 1 addition & 1 deletion src/package.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://www.mendix.com/package/1.0/">
<clientModule name="LabelSelect" version="4.4.1" xmlns="http://www.mendix.com/clientModule/1.0/">
<clientModule name="LabelSelect" version="4.5.0" xmlns="http://www.mendix.com/clientModule/1.0/">
<widgetFiles>
<widgetFile path="LabelSelect/LabelSelect.xml"/>
</widgetFiles>
Expand Down
Binary file modified test/Test.mpr
Binary file not shown.
Binary file modified test/widgets/LabelSelect.mpk
Binary file not shown.

0 comments on commit 61627e3

Please sign in to comment.