I currently have a div with a data-bind foreach statement. Inside this div is a button that uses the 'click: $parent.loadWebcam'. All of that works and the loadWebcam function is called passing the data from the foreach and processing which button was pressed.
What i am trying to accomplish is using the enable data-bind in the same way. I would like it to pass the data from the parent to a function called 'isButtonEnabled' however, it does not seem to be working the way i had hoped. Here is the function i built for isButtonEnabled, am i missing something? or can the enable data-bind just not be used in this way?
var currentStream = "";
self.isButtonEnabled = function(profile) {
return ko.observable(ko.toJS(profile).URL != currentStream);
};
and the snipplet from the page is below:
<div class="jog-panel" id="camControl">
<h1>Webcams</h1>
<div data-bind="foreach: settings.settings.plugins.multicam.multicam_profiles">
<button class="btn btn-block control-box" data-bind="click: $parent.loadWebcam, text: name, enable: $parent.isButtonEnabled">Default (before bind)</button>
</div>
</div>
Thank you