Knockout two-way left and top binding

It's known how to bind left and top by knockout.

But it allows to set a value in one direction only (model-to-view).

How can I keep two-way binding, so that when I change the position of an object (drag-and-drop) it will be actual in the model (view-to-model)?

If it isn't possible by knockout, how is the best way to implement it?

Answers


basically you will need to create a custom binding. Create a binding that accepts to the position, then in the binding create an event handler to listen for when the positions changed and write the changes back to the properties originally passed

This blog post should help

http://www.alexjamesbrown.com/blog/development/using-custom-options-with-knockoutjs-drag-and-drop/


Need Your Help

Bayes' formula for updating probabilistic map

c#-4.0 math statistics mapping probability

I'm trying to get a mobile robot to map an arena based on what it can see from a camera. I've created a map, and managed to get the robot to identify items placed in the arena and give an estimated

How to prevent form from being submitted?

javascript html forms

I have a form that has a submit button in it somewhere.