You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
then the example above seems to work. But I am not sure if it's the right way to do this. Also I don't know how this will affect the store.
Because it is not possible to have subModelTypes as class references, we did this:
Instead of registering {'type': ClassReference} in the subModelTypes property, we created a custom property MammalCollection.types = {}; and register there the subTypes.
Then we made the MammalCollection.model a function that is called on .reset() and search class by type in MammalCollection.types and return the model instance
I created a pull request with some tests in case you will accept this feature. If this is not the way it should be solved, fell free to close that pull request
Why
subModelTypes
classes can be only strings?Is it possible/correct to have
subModelTypes
class references?For example this code
to work the same as this
In our application, we create a base class, send it in event, anyone can listen the event and register its subClass
If I change the
getObjectByName
method fromto
then the example above seems to work. But I am not sure if it's the right way to do this. Also I don't know how this will affect the store.
Because it is not possible to have
subModelTypes
as class references, we did this:{'type': ClassReference}
in thesubModelTypes
property, we created a custom propertyMammalCollection.types = {};
and register there the subTypes.MammalCollection.model
a function that is called on.reset()
and search class bytype
inMammalCollection.types
and return the model instanceThen we faced the problem that
MammalCollection.model
is replaced by Backbone-relational. More details in #472The text was updated successfully, but these errors were encountered: