To all the Ti Alloy experts out there:
There are a couple of questions out there already dealing with this same problem, none of them marked with an accepted answer and certainly none answered to my personal satisfaction. Let me explain why I still believe the problem is relevant, existing answers and comments notwithstanding:
In Alloy, you are allowed to bind repeater-type elements to models in a Backbone collection; this is straightforward enough and works beautifully. However, in a typical master-detail view arrangement you may wish to bind a view to a specific model instance, which you have passed into the controller for this purpose.
As far as I've been able to make out the standard Alloy technique for this seems to be that you declare a model instance in the Alloy markup, eg. <Model id="myModelInstance" src="myBackboneModel" instance="true">
and then proceed to work with this model in the controller code by way of $.myModelInstance...
references.
The problem arises when you have passed your own model instance into the controller, as you are unable to "point" the declared view model instance to your existing model instance. You must instead "copy" your model attributes to the view's model instance by doing
$.myModelInstance.set(myPassedInModel.attributes);
This works well enough in practice, but requires that you marshall changes to the view model back to the "real" model that was passed in, and is also inconvenient if the view is to be responsive to changes in the underlying collection.
Am I missing something here, or is there perhaps a better solution I'm not aware of?
Any feedback or insights will be much appreciated.
Cheers, Francois.