On Fri, Aug 22, 2014 at 12:14 PM, S Page spage@wikimedia.org wrote:
On Fri, Aug 22, 2014 at 11:34 AM, Jon Robson jdlrobson@gmail.com wrote:
Trevor is working on a template widget for oojs which will make this possible
Great, though I don't understand what this is. Is this a specific widget that uses a specifc template, or an "platform" widget that handles templating for other OOUI widgets?
It will be a generic container for template rendering.
// Create a templatevar thing = new OO.ui.TemplateWidget( 'some way of identifying the template' );// Render the template into thing.$element thing.render( { /* some data */ } );// Add the template to the body $( 'body' ).append( thing.$element );// Render it again with different data, retaining the same this.$element reference thing.render( { /* some different data */ } );
This will also allow you to extend TemplateWidget and add methods which either change the data and either trigger re-rendering or just surgically tweak the DOM as needed.
- Trevor