Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new feature request pushAllFromModel #60

Open
luiscaiano opened this issue May 29, 2014 · 1 comment
Open

new feature request pushAllFromModel #60

luiscaiano opened this issue May 29, 2014 · 1 comment

Comments

@luiscaiano
Copy link

is it any problem to add a new feature to the array viewmodel ?
in my code i added "pushAllFromModel" , right next to result.pushFromModel defenition, it seems to work fine, but them , i don't know all the inners of the lib.
Can you add/comment about this ? if there is any issue/inpact , i would like to know.

            result.pushAllFromModel = function(items) {
                var result2 = [];

                for (p = 0, length = items.length; p < length; p++) {
                    result2[p] = recrusiveFrom(items[p], settings, newContext);
                }
                result.pushAll(result2);
            };
@luiscaiano
Copy link
Author

almost forgot,

ko.observableArray.fn.pushAll = function (valuesToPush) {
    var underlyingArray = this();
    this.valueWillMutate();
    ko.utils.arrayPushAll(underlyingArray, valuesToPush);
    this.valueHasMutated();
    return this;
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant