inputEx Documentation Back to homepage
The use of a template engine in inputEx first appeared for the Autocompleter, InPlaceEdit and Uneditable fields.
It has also proven very useful in projects that use inputEx.
The library itself doesn't include a template engine, but provides a standard way to use different engines and define your templates within field configurations. It is also very simple to add interfaces to other template engines.
The fields should use the inputEx.renderVisu method to use templates:
static <HTMLElement || String> renderVisu(visuOptions,data,parentEl)
visuOptions <Object>
- The visu parameters {visuType: 'myType', ...args...}
data <Object>
- The input data to send to the template
parentEl <HTMLElement || String>
- optional Set the result as content of parentEl
<HTMLElement || String>
Either the inserted HTMLElement or the String set to parentEl.innerHTML
Templating methods are stored in the inputEx.visus object. Methods can return either a HTMLElement or a String, since inputEx.renderVisu handle both.
inputEx.visus contains 3 default methods (you can add your own) :
inputEx.Visus methods are functions that take 2 parameters :
Check the following examples to see template usage: