1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-12-24 17:10:29 +00:00

Merge pull request #1952 from tobibeer/1937-set-refresh-filter

fixes #1937 — filter refresh in set widget
This commit is contained in:
Jeremy Ruston 2015-10-14 14:18:29 +01:00
commit b1633e0f2d

View File

@ -43,6 +43,15 @@ SetWidget.prototype.execute = function() {
this.setValue = this.getAttribute("value");
this.setEmptyValue = this.getAttribute("emptyValue");
// Set context variable
this.setVariable(this.setName,this.getValue(),this.parseTreeNode.params);
// Construct the child widgets
this.makeChildWidgets();
};
/*
Get the value to be assigned
*/
SetWidget.prototype.getValue = function() {
var value = this.setValue;
if(this.setFilter) {
var results = this.wiki.filterTiddlers(this.setFilter,this);
@ -53,9 +62,7 @@ SetWidget.prototype.execute = function() {
value = this.setEmptyValue;
}
}
this.setVariable(this.setName,value,this.parseTreeNode.params);
// Construct the child widgets
this.makeChildWidgets();
return value;
};
/*
@ -63,11 +70,12 @@ Selectively refreshes the widget if needed. Returns true if the widget or any of
*/
SetWidget.prototype.refresh = function(changedTiddlers) {
var changedAttributes = this.computeAttributes();
if(changedAttributes.name || changedAttributes.filter || changedAttributes.value || changedAttributes.emptyValue) {
if(changedAttributes.name || changedAttributes.filter || changedAttributes.value || changedAttributes.emptyValue ||
(this.setFilter && this.getValue() != this.variables[this.setName].value)) {
this.refreshSelf();
return true;
} else {
return this.refreshChildren(changedTiddlers);
return this.refreshChildren(changedTiddlers);
}
};