Example
A status code mapped to a human-readable label. The formatter only changes what's shown, the
second line below reads the same data-key directly, no formatter, to prove the stored value is
still the raw code.
<div b-context="demo.viewFormatter">
<p>Status: <b b-value="status" b-view-formatter="formatStatus"></b></p>
<p class="note">(stored value: <b b-value="status"></b>)</p>
</div>
$bindary.appData.demo.viewFormatter = { status: 2 };
ctrl.formatStatus = (templateItem, element, value) =>
{
const labels =
{ 0: 'Pending', 1: 'Processing', 2: 'Shipped', 3: 'Delivered' };
return labels[value] ?? 'Unknown';
};
Result