Skip to content

Commit

Permalink
Explain how values are converted when updating a data view (#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
AmaiKinono authored Oct 13, 2024
1 parent 2fbe4d1 commit 061504f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pages/data_bindings/views_and_controllers.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@ The following table lists all built-in data views and controllers in RmlUi, alon
[2] The text view is automatically added whenever double curly brackets {{ }} are encountered in the element's text.\
[3] These attributes enable two-way bindings, and will attach both a view and controller to the element.

When data views are updated, their data expressions are evaluated and applied to the document using any necessary type conversion, which is specified by the kind of the data view. Type conversion is done using RmlUi's built-in `TypeConverter` utilities. One aspect of this conversion is that booleans are converted to strings `"0"` or `"1"`. Consider an element

```html
<div data-attr-foo="user_data"></div>
```

where the value `user_data` is bound to a C++ variable `bool user_data = true`. The element's attribute will be set to `foo="1"`{:.attr}. Any associated RCSS attribute selector should use the same representation of the value, i.e. `div[foo=1]`.

#### Attribute
{:#data-attr.data-desc}
Expand Down

0 comments on commit 061504f

Please sign in to comment.