Skip to content
This repository was archived by the owner on Oct 8, 2021. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified dist/TreeView.mpk
Binary file not shown.
60 changes: 30 additions & 30 deletions src/TreeView/widget/GridView.js
Original file line number Diff line number Diff line change
Expand Up @@ -318,38 +318,37 @@ mxui.widget.declare("TreeView.widget.GridView", {
setSelection : function(item) {
logger.debug("TreeView.widget.GridView.setSelection");
//the same selection?
if (!item && !this.hasSelection ||
item && this._multiSelection.length === 1 && this._multiSelection[0] === item)
return;

this._inMultiSelectMode = false;
if ((!item && !this.hasSelection) || (item && this._multiSelection.length === 1 && this._multiSelection[0] === item)) {
return;
}

while(this.hasSelection())
this.removeFromSelection(this.getLastSelection(), true);
this._inMultiSelectMode = false;

if (item)
this.addToSelection(item, true);
while(this.hasSelection()) {
this.removeFromSelection(this.getLastSelection(), true);
}

if (this.selectionref)
TreeView.widget.Commons.store(this.contextObject, this.selectionref, item && item.guid);
if (item) {
this.addToSelection(item, true);
}

if (this.selectionrefset)
TreeView.widget.Commons.store(this.contextObject, this.selectionrefset, item && item.guid);
if (this.selectionref) {
TreeView.widget.Commons.store(this.contextObject, this.selectionref, item && item.guid);
}

this.saveAndFireSelection(item);
},
if (this.selectionrefset) {
TreeView.widget.Commons.store(this.contextObject, this.selectionrefset, item && item.guid);
}

multiSelectClick : function(node, e) {
logger.debug("TreeView.widget.GridView.multiSelectClick");
var record = this.getRowForNode(node);
/*var ms = this._multiSelection;
if (item) {
this.saveAndFireSelection(item);
}
},

//clicking the current selection and selection length = 1?, reenable selection
if (ms.length == 1 && ms[0] == record) {
node.checked = true;
}
multiSelectClick : function(node, e) {
logger.debug("TreeView.widget.GridView.multiSelectClick");
var record = this.getRowForNode(node);

else {*/
if (node.checked)
this.addToSelection(record);

Expand Down Expand Up @@ -466,14 +465,15 @@ mxui.widget.declare("TreeView.widget.GridView", {
logger.debug("TreeView.widget.GridView.update");
//use the new context
this.contextObject = obj;
this.contextGUID = obj.getGuid();
this.listenToContext();
this.contextGUID = (this.contextObject && this.contextObject !== undefined) ? this.contextObject.getGuid() : null;

//reload
this.resetAndFetchAll(dojo.hitch(this, this.updateSelectionFromContext));
this.listenToContext();

cb();
},
//reload
this.resetAndFetchAll(dojo.hitch(this, this.updateSelectionFromContext));

mendix.lang.nullExec(cb);
},

suspended : function() {
this._suspended = true;
Expand Down
Binary file modified test/widgets/TreeView.mpk
Binary file not shown.