Giter VIP home page Giter VIP logo

Comments (7)

kmalakoff avatar kmalakoff commented on September 14, 2024

I haven't tried, but if you want to quickly check, you could load them in the browser and replace window.Backbone with ampersand.

from knockback.

wasd171 avatar wasd171 commented on September 14, 2024

AmpersandJS has a different structure, many independent modules. kb.ViewModel works fine, but looks like kb.collectionObservable is broken

from knockback.

abradley2 avatar abradley2 commented on September 14, 2024

Ampersand collections: mainIndex specifies the attribute used in .get
https://github.com/AmpersandJS/ampersand-collection/blob/master/ampersand-collection.js#L164

Backbone collections: modelId specifies the attribute used in .get

Not sure if this is particularly applicable to Knockback, but this discrepancy alone is enough to mean Ampersand Collections are not guaranteed to be usable as drop in replacements for Backbone Collections.

from knockback.

kmalakoff avatar kmalakoff commented on September 14, 2024

You should be able to stick the model and collection in an object to manually aggregate them.

As for ids, I don't think they are referenced anywhere.

I'd give it a shot and see if it works.

from knockback.

wasd171 avatar wasd171 commented on September 14, 2024

This works as a partial replacement for kb.collectionObservable

collectionObservable = (@collection, @options) ->
    return ko.observableArray( @collection.map( (model) => new @options.view_model(model) ) )

from knockback.

kmalakoff avatar kmalakoff commented on September 14, 2024

Yeah, that's definitely a possible approximation. It won't give you two-way syncing though.

I'll take a look at this in my spare time to see if I can officially support ampersand. I support Parse so hopefully it shouldn't be too hard to support another similar model framework.

from knockback.

kmalakoff avatar kmalakoff commented on September 14, 2024

Closed due to inactivity

from knockback.

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.