mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-02-04 13:19:11 +00:00
Allow indeterminate checkboxes in list and filter modes
This change may require some tweaks to the unit tests to be able to test it properly.
This commit is contained in:
parent
b4e512760e
commit
6afcb151be
@ -27,6 +27,7 @@ CheckboxWidget.prototype = new Widget();
|
||||
Render this widget into the DOM
|
||||
*/
|
||||
CheckboxWidget.prototype.render = function(parent,nextSibling) {
|
||||
var value;
|
||||
// Save the parent dom node
|
||||
this.parentDomNode = parent;
|
||||
// Compute our attributes
|
||||
@ -38,9 +39,13 @@ CheckboxWidget.prototype.render = function(parent,nextSibling) {
|
||||
this.labelDomNode.setAttribute("class",this.checkboxClass);
|
||||
this.inputDomNode = this.document.createElement("input");
|
||||
this.inputDomNode.setAttribute("type","checkbox");
|
||||
if(this.getValue()) {
|
||||
value = this.getValue();
|
||||
if(value) {
|
||||
this.inputDomNode.setAttribute("checked","true");
|
||||
}
|
||||
if(value === undefined) {
|
||||
this.inputDomNode.indeterminate = true;
|
||||
}
|
||||
if(this.isDisabled === "yes") {
|
||||
this.inputDomNode.setAttribute("disabled",true);
|
||||
}
|
||||
@ -267,9 +272,13 @@ CheckboxWidget.prototype.refresh = function(changedTiddlers) {
|
||||
this.refreshSelf();
|
||||
return true;
|
||||
} else {
|
||||
var refreshed = false;
|
||||
var refreshed = false, value;
|
||||
if(changedTiddlers[this.checkboxTitle]) {
|
||||
this.inputDomNode.checked = this.getValue();
|
||||
value = this.getValue();
|
||||
this.inputDomNode.checked = !!value;
|
||||
if(value === undefined) {
|
||||
this.inputDomNode.indeterminate = true;
|
||||
}
|
||||
refreshed = true;
|
||||
}
|
||||
return this.refreshChildren(changedTiddlers) || refreshed;
|
||||
|
Loading…
Reference in New Issue
Block a user