Git Product home page Git Product logo

Comments (7)

sagacity avatar sagacity commented on August 17, 2024

The reason the mapping plugin does not do this, is that there is no clean way to signal deletions.

from knockout.mapping.

luv2code avatar luv2code commented on August 17, 2024

I think it would be alright to not be expected to support deletions this way. I mean, there really isn't a clean way to do it. So, one might be expected to explicitly call a mappedRemove(key).

but I can dig it if you don't want to add it to the library.

from knockout.mapping.

sagacity avatar sagacity commented on August 17, 2024

No, I think this alternate behavior could also be a nice feature. But it
would have to be explicitly enabled using a mapping configuration option.
This way it wouldn't break any existing code.
If you can add a pull request implementing that, it would be very welcome :)

On Fri, Dec 9, 2011 at 17:40, Matthew Taylor <
[email protected]

wrote:

I think it would be alright to not be expected to support deletions this
way. I mean, there really isn't a clean way to do it. So, one might be
expected to explicitly call a mappedRemove(key).

but I can dig it if you don't want to add it to the library.


Reply to this email directly or view it on GitHub:

#41 (comment)

from knockout.mapping.

luv2code avatar luv2code commented on August 17, 2024

turn it on like this?

var vm = ko.mapping.fromJS([], { arrayUpdate: true, arrayInsert:true });

from knockout.mapping.

sagacity avatar sagacity commented on August 17, 2024

well, more something along the lines of { incrementalArrayUpdates: true }
to indicate that what you receive from the server is an incremental update,
instead of a 'full' state.
additionally, if the data from the server contains a "_destroy" property in
an array, that could be an indication to delete (similar to what you can do
with array.destroy(item) in an observable array).

On Fri, Dec 9, 2011 at 19:13, Matthew Taylor <
[email protected]

wrote:

turn it on like this?

var vm = ko.mapping.fromJS([], { arrayUpdate: true, arrayInsert:true });

Reply to this email directly or view it on GitHub:

#41 (comment)

from knockout.mapping.

luv2code avatar luv2code commented on August 17, 2024

I gave this a shot; but I'm out of time. the updateViewModel function is hard to get my mind around. I kept breaking other unit tests without actually getting my change to work. I strongly feel that the function is too large and needs to be refactored into smaller chunks.

I'm giving up for now. I might come back to it later.

from knockout.mapping.

sagacity avatar sagacity commented on August 17, 2024

Fair enough, development of the plugin has been fairly, shall we say, iterative :) So there is definitely a lot to be gained by cleaning it up. Sadly, with limited time on my side this has fallen by the wayside.

By the way, if you have any suggestions on restructuring the code and so on, by all means let me know. Good suggestions are always welcome!

from knockout.mapping.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.