Skip to content

Commit f0e655b

Browse files
author
Jelte Lagendijk
committed
Fix when no objects are found
1 parent 7a503a7 commit f0e655b

2 files changed

Lines changed: 11 additions & 7 deletions

File tree

dist/SimpleCheckboxSetSelector.mpk

-38 Bytes
Binary file not shown.

src/SimpleCheckboxSetSelector/widget/SimpleCheckboxSetSelector.js

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ define([
4646
_entity: null,
4747
_labelAttribute: null,
4848
_reference: null,
49-
_handles: null,
5049
_contextObj: null,
5150
_alertDiv: null,
5251
_checkboxOptions: null,
@@ -57,18 +56,13 @@ define([
5756
_checkboxesArr: null,
5857
_showMoreHidden: true,
5958
_showMoreButtonHandler: null,
60-
6159
_showMoreStarted: false,
60+
_oldReferenceObjects: [],
6261

6362
/**
6463
* Mendix Widget methods.
6564
* ======================
6665
*/
67-
constructor: function () {
68-
// Uncomment next line to start debugging
69-
//logger.level(logger.DEBUG);
70-
this._handles = [];
71-
},
7266

7367
// DOJO.WidgetBase -> PostCreate is fired after the properties of the widget are set.
7468
postCreate: function () {
@@ -271,6 +265,11 @@ define([
271265
this._checkboxOptions = {};
272266
this._checkboxOptionsArray = [];
273267

268+
if (!objs) {
269+
this._updateRendering();
270+
return;
271+
}
272+
274273
for (var i = 0; i < objs.length; i++) {
275274
var mxObj = objs[i];
276275
this._checkboxOptions[mxObj.getGuid()] = mxObj.get(this.displayAttribute);
@@ -283,6 +282,7 @@ define([
283282
};
284283

285284
var referencedObjects = this._contextObj.get(this._reference);
285+
286286
if (referencedObjects !== null && referencedObjects !== "") {
287287
dojoArray.forEach(referencedObjects, function (ref, i) {
288288
if (mxObj.getGuid() === ref) {
@@ -331,6 +331,10 @@ define([
331331
dojoConstruct.empty(this.checkboxComboContainer);
332332
}
333333

334+
if (this._checkboxOptionsArray.length === 0) {
335+
dojoConstruct.empty(this.checkboxComboContainer);
336+
}
337+
334338
for (var o = 0; o < this._checkboxOptionsArray.length; o++) {
335339
var option = this._checkboxOptionsArray[o];
336340
if (option.value) {

0 commit comments

Comments
 (0)