raptorjs-legacy / raptorjs

Source code for the RaptorJS Toolkit
Other
94 stars 12 forks source link

Raptor Templates: Add support for attaching arbitrary data to widgets via attributes (similar to HTML5 data attributes) #17

Open patrick-steele-idem opened 11 years ago

patrick-steele-idem commented 11 years ago

Data can be attached to a widget by providing individual properties:

<ui:button w:data-database-id="data.databaseId" .../>

Or, data can be attached to a widget by providing a data object

<ui:button w:data-database-id="data.databaseId" .../>

The data is then attached to the widget and can be accessed using a special "data" property:

var myButtonWidget = this.getWidget("myButton");
var databaseId = myButtonWidget.data['database-id'];

NOTE: "data" now becomes a reserved property of widgets. Is that okay?

Open issues: