I'm attempting to use the knockout sortable plugin to work with two html lists based off of one knockout array filtered into two arrays. I keep getting errors and I believe it may have to do with the fact that I'm returning "computed" instead of "observableArray" objects, but I haven't been able to find a solution.
http://jsfiddle.net/thebassix/Eg2DG/4/
I believe my main part of the problem is:
hiddenSeries = ko.computed(function() {
{
var seriesArray = self.series();
return ko.utils.arrayFilter(seriesArray, function(item) {
return item.Hidden();
});
}
});
unhiddenSeries = ko.computed(function() {
{
var seriesArray = self.series();
return ko.utils.arrayFilter(seriesArray, function(item) {
return !(item.Hidden());
});
}
});
The sortable plugin needs an observableArray to operate on, so that it can place the item back into the correct location.
Your best bet is probably to split the data into two observableArrays and then create a computed to represent the combined set (if you need to send it back to the server).
Maybe something along the lines of:
Sample: http://jsfiddle.net/rniemeyer/NhUEm/