Closed 6pm closed 8 years ago
@6pm The model doesn't appear to be synced in this plugin (looking at the code)
Using this in the options for sortable does work for me.
onUpdate: function (evt) {
var old = evt.oldIndex,
now = evt.newIndex,
data = this.data; // Replace with your own array to sort
data.splice(now, 0, data.splice(old, 1)[0]);
}.bind(this)
Sorry for the slow response, but @LostKobrakai has the right approach. @nblackburn is correct, the plugin does not make any assumptions about your data. This is the same approach that you'd have to take if you were using sortable
outside of Vue.
I will add this approach to the docs.
This should be in official docs..!
It'd be very useful if there is option to specify data
array. E.g. v-sortable="{model: data}"
Or sotable-array="data"
, which can be implemented by params: ['sotable-array']
in directive.
I add object with options in list then init plugin. After sorting items source object remained unchanged. Нow to get sorted object? Whether this plugin can't this?