Skip to content

Commit

Permalink
Create custom.js
Browse files Browse the repository at this point in the history
  • Loading branch information
jthompson-arcus committed Dec 2, 2024
1 parent 36f843a commit e98afa0
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions inst/app/www/custom.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
function ts(cb) {
if (cb.readOnly) cb.checked=cb.readOnly=false;
else if (!cb.checked) cb.readOnly=cb.indeterminate=true;
}

var customCheckbox = new Shiny.InputBinding();

$.extend(customCheckbox, {
find: function(scope) {
return $(scope).find("input[type='checkbox'].cs_checkbox");
},
getValue: function(el) {
return el.checked;
},
subscribe: function(el, callback) {
$(el).on("change.checkboxInputBinding", function() {
Shiny.onInputChange($(this).attr('id'), this.checked, {priority: 'event'});
});
},
unsubscribe: function(el) {
$(el).off(".checkboxInputBinding");
}
});

Shiny.inputBindings.register(customCheckbox);

0 comments on commit e98afa0

Please sign in to comment.