Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-10007] TiAPI: Be able to set a group of adhoc properties to any proxy at runtime - see description

GitHub Issuen/a
TypeStory
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2012-08-15T20:57:19.000+0000
Affected Version/sRelease 2.1.0
Fix Version/sSprint 2012-17 API, Release 3.0.0
ComponentsTiAPI
Labelscore, look1
ReporterRussell McMahon
AssigneeNeeraj Gupta
Created2012-07-17T13:02:44.000+0000
Updated2017-03-16T22:05:18.000+0000

Description

Like we do at create time where we can pass in an object representing properties, it would be helpful to have the same functionality available at runtime through an API like a applyProperties setter or getter or applyProperties({}) method. In Alloy we will dynamically set properties it would help performance if we could call a method to bulk set properties. For example win1 = createWindow({ backgroundColor:'#336699', borderWidth:8, borderColor:'#999', height:400, width:300, borderRadius:10, opacity:0.92,}) currently is being done and the properties are being passed. A developer would like to have a way at runtime to change properties in a bulk for example win1.applyProperties({ backgroundColor:'#336699', borderWidth:8, borderColor:'#999', height:400, width:300, borderRadius:10, opacity:0.92, }); Benefits - code speed, and reduced code size Edit: In discussion, the word styles were dropped because 1) some properties are not logically part of a style and 2) we wanted to avoid confusion given how complex and interacting styles can be. Note that this is different than applyLayout because this is to be done at the proxy level (IE, you can do this to sounds, to HTTPClient, etc) and does not delay or apply other logic like applyLayout does. Instead, foo.applyProperties({bar:5, baz:"bat"}) is identical to foo.bar=5; foo.baz="bat"; but is more compact and more importantly, reduces bridge traversal.

Comments

  1. Bryan Hughes 2012-08-08

    Note: this should be implemented in Ti.Proxy (Evented in Mobile Web's case).
  2. Vishal Duggal 2012-08-09

    The feature says this is for UI objects. In which case isn't this already supported by the updateLayout({}) call on ViewProxies?
  3. Blain Hamon 2012-08-09

    Updating ticket to better represent the decisions made during architectural.
  4. Lee Morris 2017-03-16

    Closing ticket as fixed.

JSON Source