I would like to bind a visible property to be true when one of two conditions are true. Something like the following
<tr data-bind="visible: active || $parent.displayDeactive">....</tr>
My code works when I do one or the other bindings but not when I put the || in there. I haven’t found any documentation that says I can put any logic in this binding, but if I can’t do it directly what is the est way to do it since I am binding a property of a template and one object of the $parent viewmodel.
If you are using the value of an observable in an expression then you need to reference them as a function. So, if
activeanddisplayDeactiveare observables you would do:data-bind="visible: active() || $parent.displayDeactive()"There are a few ways to move it to the view model, you could:
Sample of logic in the binding and using a function on the parent here: http://jsfiddle.net/rniemeyer/f6ZgH/