Jeroen's answer is great and right, I wanted to add an add using SO comments, but this is better seen with full formatting, I think.
Materialization seems a little strange if it is tied to the disable binding when placed on an element, especially if this function is disabled when updating an observable other knockout (which is usually there).
In my update function, I use the following:
if(allBindings().disable != undefined && allBindings().disable == true){ $(element).prop("disabled", true); } else{ $(element).prop("disabled", false); } $(element).material_select();
At first I tried just calling $(element).material_select() in the update function, but it seems to be a little low-powered, only working for a while. Explicitly changing the disabled property on an element seems to work every time.
Most likely, this is a much more concise way to do this, but hopefully this example illustrates the point: explicitly set the disabled property based on the binding state.
I do not know if similar problems occur using other bindings, visible , etc., but if they are, these problems can be solved in a similar way.
Eli hooten
source share