data-next-query

Writes a value of the object model into the element and keeps it current. The path is the one next.query() takes and events carry: cart.total, selector.main.price, order.number.

CODE
<span data-next-query="cart.total" data-next-empty="…"></span>
<img data-next-query="package.42.image" alt="" />
<a data-next-query="order.status_url">Track your order</a>

Inside an option, an each row or a data-next-for, a path that is not a root reads that object: data-next-query="total".

A field its object does not have, such as cart.totl, logs a warning once (unknown field "totl" on Cart in data-next-query="cart.totl") and is marked in the debug panel's Elements tab, for data-next-show, -hide, -each and -for too. A field not known yet, such as cart.total before the price arrives, and one the page defines are not.

How a value is written

ElementGets
img, sourcesrc / srcset
ahref
input, textarea, selectvalue
any otherits text: money, percentage or number by the field's name, else as is
an addresson one line: street, city, state and postcode, country
a listhow many items it has

A field named price, *_price, total, *_total, subtotal, tax or amount is money in the campaign's currency; *percentage is a percentage. A value not known yet (before the campaign or a price arrives) is written as data-next-empty, or empty.

Attributes

AttributeMeans
data-next-empty="<text>"Shown while there is no value
data-next-formatHow a number is written, when its name does not say
data-next-formatWrites
currency$39.00
currency_code$39.00 USD
currency_rounded$39 (no cents when they are .00)
percentage25%
number39
phonea 10-digit number as (555) 123-4567
addressthe value as is

A field a page adds with next.define(type, name, fn, { format }) reads like the SDK's own, in that format (see the JavaScript API).