Menu

bound-content

An HTML content command that can used to set the content of its host element to a value from the Collection of a bound-repeat. Typically this also requires the host element to exist within the host element of the bound-repeat, but this requirement can be circumvented through use of the bound-content-of-repeat secondary attribute.

The primary attribute expression of this command should always refer to the item variable created by bound-repeat. The host element's content will then be set to the resolved value of the expression. If the value contains HTML formatting, the tags will become proper HTML elements under the host element. Note that this command does not provide any editing capabilities of the value it brings; it is simply a substitute of the content command that is compatible with bound-repeat, which content is not.

If bound-content is evaluated in uneditable content (a composeContent command whose editable attribute is false does this), this content command's functionality becomes exactly that of its "not-bound" kin, the HTML content command content.

This command has a priority of 15 if evaluated in HTML content declared as uneditable. Otherwise its priority can be considered to be lower compared to all other HTML content commands besides bound-repeat, which operates at a higher priority. 

Parent commands

  • bound-repeat
    Required. While this content command doesn't necessarily need to exist within the structure inside this parent command's host element, it does require at least one instance of bound-repeat to exist in the same Screen.

Secondary attributes

bound-content-of-repeat

Required
Value type
EL-evaluated
No String
No
This attribute can be used to link this bound-value to a bound-repeat, allowing this command to access that bound-repeat's item values even if this command's host element is not inside bound-repeat's host element. The resolved value of this attribute should match the bound-repeat-name value of the bound-repeat that this command should be linked to.

When using this link, the host element will receive the defined value of the currently targeted item of the repeat, switching as the targeted item changes. The primary attribute expression of bound-content will also have to refer to this item with the variable "targetItem" instead of the bound-repeat-var of the linked repeat.

Note that this attribute has no effect if this command is evaluated in uneditable content. 

Examples

Unlike all the other commands of the "bound" family, bound-content exists to bring content not meant to be edited into a bound-repeat. If displaying products for example, you might want to show the product's name or ID without letting the users alter it.

<table>
  <tr dyn-bound-repeat="products" dyn-bound-repeat-var="product" dyn-bound-repeat-name="products">
    <td>
        <span dyn-bound-content="product.name">Name here</span>
    </td>
    <td>
       <input dyn-bound-value="product.quantity" />
    </td>
  </tr>
</table>  

For an example on the use of the bound-content-of-repeat attribute, please see the examples section of bound-repeat.

Comments

0 comments