Reputation: 317
I have a Knockout model that uses the mapping and validation plugins and cannot get it to play nice with Ryan Niemeyer's Knockout sortable plugin - I get the simple error:
Uncaught TypeError: undefined is not a function
The error (which lands on the sortable plugin js), indicates that there is no root element assigned, but I'm not 100% on where this should be set.
When I change "sortable" to "foreach" the model works fine, no errors so I guess something basic is astray.. would very much appreciate any comments.
http://jsfiddle.net/ajson/E23yK/24/
<div data-bind="sortable:Regions">
<div class="Regionbox">Region:
<input data-bind="value:Name" /> <a href="#" data-bind="click: $parent.removeRegion">x</a>
</div>
</div>
Upvotes: 1
Views: 292
Reputation: 139758
The knockout-sortable has the following dependencies:
In your fiddle you are missing jQuery UI so it throws the undefined is not a function
exception.
To fix it you just need to include jQuery UI in your code.
Demo JSFiddle.
Upvotes: 4