Titanium JIRA Archive
Alloy (ALOY)

[ALOY-986] Alloy: Allow 'binding' properties to be set on an Alloy view from a controller

GitHub Issuen/a
TypeImprovement
PriorityLow
StatusResolved
ResolutionDuplicate
Resolution Date2014-04-10T17:27:46.000+0000
Affected Version/sAlloy 1.3.1
Fix Version/sn/a
Componentsn/a
LabelsAlloy, bindings, controller
ReporterLee Driscoll
AssigneeUnknown
Created2014-04-08T08:44:08.000+0000
Updated2018-03-07T22:25:54.000+0000

Description

It would be really useful to be able to do something like the following. At the moment it is impossible because all of the binding properties are 'creation only'. The benefit of this is that you would be able to create reusable widgets that use Alloy Data Bindings.
var listWindow = Alloy.createController('listWindow', {
  dataCollection: 'people',
  dataTransform: function(model){ 
    model.fullName = model.firstName + ' ' + model.lastName;
    return model;
  },
  dataFilter: function(collection){
    return collection.where({firstName: 'Fred'});
  },
  rowTitle: "{fullName}"
});
<Alloy>
  <Window navBarHidden="false">
    <TableView id="table">
      <TableViewRow id="tableRow" />
    </TableView>
  </Window>
</Alloy>
$.table.dataCollection = Alloy.createCollection(args.dataCollection);
$.table.dataTransform = args.dataTransform;
$.table.dataFilter = args.dataFilter;
$.tableRow.title = args.fullName;

Comments

  1. Ritu Agrawal 2014-04-10

    Moving this improvement request to engineering for further evaluation and prioritization.
  2. Tim Poulsen 2014-04-10

    Great suggestion. This looks to be a duplicate of ALOY-931. I'm going to close this ticket, but link 931 to this one to save reference to your implementation suggestion.

JSON Source