Controls

toggle

source Object to watch for changes on. Defaults to $dataItem in the current template context.
on Object to test. Typically a {binding } or {~ } is used to set this property.
when Compared to the on property when it changes to see if action needs to occur. This value can be: Not specified - in which case, on is tested for trueness Value - in which case it is compared to the on value Function - in which case, the function is passed the on value and its return value is tested for trueness. function (on) { }
action Options: hide/show, render/dispose, enable/disable, addClass/removeClass
class Indicates which class to add or remove when using the addClass or removeClass actions


Markup Extensions

{~ path [, source=expr][, transform=expr][, required=paths][, targetProperty=name] } - lazy evaluator

Evaluates an expression in a lazy fashion using LazyLoader.eval(). Objects along the path that are not loaded are loaded
as needed. When the path has been evaluated, the evaluator sets the target property. If targeting a dataview or content control's data property, this will cause the UI to refresh.

Parameters:

path Path to evaluate. If not specified, the current $dataItem is used for the result.
source= Optional. Object to evaluation path against. Defaults to $dataItem in the current template context.
transform Optional. Expression invoked on $transform(source.path). This can be used when path evaluates to an array to modify the result. If the underlying list changes, the evaluator will refresh.
targetProperty Optional. Overwrite the interpreted target property of the markup extension. For example, you may want to target the innerHTML property of an element rather than innerText.
required Optional. Require that additional paths, relative to the resulting objects, should be loaded as well. This is useful if the template markup or potentially selected templates depend on these additional paths.
format Optional. The resulting value will be formatted using the type's format of the given name. For example, use "ShortDate" to format the resulting Date object.


{@ path [, optionsTransform=expr][, displayFormat=format][, systemFormat=format] } - metadata adapter

Creates an Adapter which contains metadata about property on a specific model instance. The resulting Adapter can be used in templates to generalize HTML markup.

Parameters:

path Property path to get metadata for.
source= Optional. Object to evaluation path against. Defaults to $dataItem in the current template context.
optionsTransform=expr Optional. Expression invoked on $transform(adapter.options). This can be used to sort and filter the allowed values exposed by the options. Example: optionsTransform=orderBy('Name desc')
displayFormat=format Optional. Overrides the display format used to format the displayValue property of the adapter. The default formatting is taken from the format defined for the property identified by path, or if that's not specified, the $display format defined for the property's type.
systemFormat=format Optional. Overrides the system format used to format the systemValue property of the adapter. The default formatting is taken from the format defined for the property identified by path, or if that's not specified, the $display format defined for the property's type.
<name>=<value> Optional. Other arbitrary custom properties can be passed into the adapter. This value can be accessed as properties off of the adapter and may be useful inside of templates.


The adapter that is created by the markup extension is used heavily instead of templates. These Adapter properties can be used inside of a template:

Properties:

path Property path to get metadata for.
rawValue The unformatted value of the property. Can be used in binding expressions for one or two-way binding. Read/write.
displayValue The string value of the property, formatted using the displayFormat. Can be used in binding expressions for one or two-way binding. Read/write.
systemValue The string value of the property, formatted using the systemFormat. Can be used in binding expressions for one or two-way binding. Read/write.
options If the property has allowed values then this will be an array of objects that represent those values. Each object in the array also has "systemValue" and "displayValue" properties so that templates can work with a common data format.
<name> Optional. Other arbitrary custom properties that were passed to the markup extension.

Helper Methods

$parentContextData (element or control or context[, index, [level, [type]]])

Gets a template data item corresponding to the $dataItem variable. This is useful when you need template data outside of the context of rendering a template, or data for a parent template.

element/control/context The object used as the first (and only required) parameter can take a number of forms: HTML element, ASP.NET AJAX Control, or template context.

Last edited Dec 20, 2010 at 3:28 PM by matthooper, version 7

Comments

No comments yet.