Q: Knockout - Foreach function with enable function 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

A: I would suggest, since you want to update the enabled status when the button is clicked, that you add that logic into the click event instead of having a separate function. The isButtonEnabled can be a normal observable variable instead of a function, and that variable gets updated by the click event.
  self.loadWebcam = function(profile) {
      profile.isButtonEnabled(ko.toJS(profile).URL != currentStream);
      console.log(ko.toJS(profile).URL);
  };



var currentStream = "test url";

function viewModel(){
 var self = this;
  var profile1 = { URL: 'test url', name: 'test profile', isButtonEnabled: ko.observable(true) }; //test data
  var profile2 = { URL: 'other url', name: 'other profile', isButtonEnabled: ko.observable(true) }; //test data
  
  self.multicam_profiles = ko.observableArray([profile1, profile2]);
  
  self.loadWebcam = function(profile) {
      profile.isButtonEnabled(ko.toJS(profile).URL != currentStream);
      console.log(ko.toJS(profile).URL);
  };
}

ko.applyBindings(new viewModel());
<script src="https://cdnjs.cloudflare.com/ajax/libs/knockout/3.4.2/knockout-min.js"></script>

currentStream: "test"

<div class="jog-panel" id="camControl">
    <h1>Webcams</h1>
    <div data-bind="foreach: multicam_profiles">
        <button class="btn btn-block control-box" data-bind="click: $parent.loadWebcam, text: name, enable: isButtonEnabled">Default (before bind)</button>
    </div>
</div>


