Titanium JIRA Archive
Alloy (ALOY)

[ALOY-1699] Add support for using code in View XML attributes

GitHub Issuen/a
TypeNew Feature
PriorityNone
StatusOpen
ResolutionUnresolved
Affected Version/sn/a
Fix Version/sn/a
Componentsn/a
Labelsn/a
ReporterBrenton House
AssigneeEwan Harris
Created2019-08-06T18:15:29.000+0000
Updated2019-08-07T14:57:45.000+0000

Description

Add support for using code in View XML attributes This would allow a developer to do something like this:
<Label id="label2b" color="#999" text="~true ? 'this is true' : 'this is false'~" />
and the generated code would look something like this:
$.__views.label2b = Ti.UI.createLabel(
  { 
      width: Ti.UI.SIZE, 
      height: Ti.UI.SIZE, 
      color: "#999", 
      id: "label2b", 
      text: true ? 'this is true' : 'this is false',
   });
bq. A good real world example of using this would be when you are using Data Binding with a ScrollView. When doing this and using the onClick event, you do not receive an index property to know what model (from the dataCollection) that is bound to the control you clicked on. With this feature, I am able to add an index attribute and thus get parity with using Data Binding with ListViews or TableViews.

Comments

No comments

JSON Source