I need a checkbox bound to a bool in my model...however on click I need to persist that change to a webservice.
So in this case I need the checkbox to show the state of the model, then the click event I need to send the value and then call a function to update a count based on the model.
What's HAPPENING though it seems is this
1) Checked
2) Ajax Call
3) Ajax Complete
4) Function Runs to get count (checks bool state)
5) Bool state changed
So I know this because if I set a timeout on step 4
...then the count updates okay...
So if I could subscribe to a change on the property (somehow) then the function could run AFTER it changes.
Steve
data-bind=
"checked: AvailableToHamilton, click: shareWith"
So in this case I need the checkbox to show the state of the model, then the click event I need to send the value and then call a function to update a count based on the model.
What's HAPPENING though it seems is this
1) Checked
2) Ajax Call
3) Ajax Complete
4) Function Runs to get count (checks bool state)
5) Bool state changed
So I know this because if I set a timeout on step 4
success:
function
(e) {
setTimeout(
function
(){
viewModel.getTotalCapacity();
}, 100);
}
...then the count updates okay...
So if I could subscribe to a change on the property (somehow) then the function could run AFTER it changes.
Steve