Question

I have my application with MVC4/Knockout.js. I am not able to get why i am getting error in IE9. Error details are as below:-

SCRIPT3: Member not found. knockout-2.2.0.debug.js, line 1068 character 13

Screenshot is as below:

IE9 Error screenshot

I am not even including knockout-2.2.0.debug.js

Thanks for your time and your help.

@Sivanv

Was it helpful?

Solution

you can use RP Niemeyer's solution, it worked for me.

ko.bindingHandlers.uiSortableList = {
        init: function (element, valueAccessor, allBindingsAccesor, context) {
            var $element = $(element),
                list = valueAccessor();

            $element.sortable({
                containment: 'parent',
                placeholder: 'placeholder',
                update: function (event, ui) {
                    var item = ko.dataFor(ui.item[0]),
                        newIndex = ko.utils.arrayIndexOf(ui.item.parent().children(), ui.item[0]);
                    if (newIndex >= list().length) newIndex = list().length - 1;
                    if (newIndex < 0) newIndex = 0;

                    ui.item.remove();
                    list.remove(item);
                    list.splice(newIndex, 0, item);
                }
            });
        }
};

var ViewModel = function (items) {
    this.items = ko.observableArray(items);

    this.data = ko.computed(function() {
        return ko.toJSON(this.items());
    }, this);
};

    var vm = new ViewModel([ { name : 'foo' }, { name : 'bar' }, { name : 'baz' }]);

ko.applyBindings(vm);

Here is the jsFiddle link

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top