[ALOY-1699] Add support for using code in View XML attributes
GitHub Issue | n/a |
---|---|
Type | New Feature |
Priority | None |
Status | Open |
Resolution | Unresolved |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | n/a |
Labels | n/a |
Reporter | Brenton House |
Assignee | Ewan Harris |
Created | 2019-08-06T18:15:29.000+0000 |
Updated | 2019-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.
No comments