backbone-relational id references with backbone.marionette -
i use backbone-relational's includeinjson: 'id' include related model ids avoid spamming server-side whole object tree. unfortunately, backbone.marionette.view default exposes attributes of view mode returned tojson, means related models no longer accessible in view templates.
i realize need custom marionette.view serializedata. needed models, i'm hoping solve generically; i.e. override serializedata views such right thing backbone-relational id references.
any chance someone's done this? i'm not hopeful of that, figure there others use this, if nothing else serve place dump solution once i've coded it. :)
any solution require 1 of these options:
define 2 versions of tojson models, 1 uses includeinjson , other treats true.
some way punch hole through marionette's restriction on view templates using model attributes , attribute-based helpers.
i've got functional solution using option #1, it's such hack can't bear post publicly. basically, in serializedata i'm reaching model , modifying _relations before , after call tojson. not thread safe , ugly heck. hoping come , find proper solution.
Comments
Post a Comment