The View page
A read-only page for one record. There are no inputs to type into, so the client API reads the displayed values and styles them. Each recipe says exactly where the code goes.
Events this page fires
| Event | Where | Use for |
|---|---|---|
| Before View Load | Table → Page Events (PHP) | Reshape data / add computed values before the record shows. |
| Process Record Values | Table → Page Events (PHP) | Format a single value for display. |
| On Page Init | Table → Client Events (JS) | Highlight, conditional formatting, wire buttons. |
Recipes
1 · Make a field red (the classic)
WhereEvents → orders → Client Events → On Page InitJS
var ctrl = Runner.getControl('status');
ctrl.addStyle('color: red; font-weight: 700');
2 · Conditional formatting on a value
WhereEvents → orders → Client Events → On Page InitJS
if ((+Runner.getControl('balance').getValue() || 0) < 0) {
Runner.getControl('balance').addStyle('color:#dc2626'); // getValue() reads the shown text on View
}
3 · Show a computed value that isn't a column
WhereEvents → orders → Page Events → Before View LoadPHP
// add a value your View page displays (place a Text/HTML component bound to it, or read it in Process Values)
$data['days_open'] = (int) ((time() - strtotime($data['created_at'])) / 86400);
4 · Format one value for display
WhereEvents → orders → Page Events → Process Record ValuesPHP
if (isset($data['total'])) $data['total'] = '$' . number_format((float) $data['total'], 2);
5 · Add an action button (Custom Button) to the View page
Drop a Custom Button on the View page in the Designer.
WhereDesigner → Custom Button → Client BeforeJS
if (!await pp.dialog.confirm('Send a reminder to the customer?')) return false;
params.id = pp.page.id;
WhereDesigner → Custom Button → ServerPHP
$row = dbRow('SELECT customer_email, reference FROM orders WHERE id = ?', [$params['id']]);
pp_send_email($row['customer_email'], 'Reminder', 'Your order ' . $row['reference'] . ' is awaiting payment.');
$result['sent'] = true;
WhereDesigner → Custom Button → Client AfterJS
if (result.sent) pp.dialog.toast('success', 'Reminder sent.');
6 · Read every displayed value
WhereEvents → orders → Client Events → On Page InitJS
var data = Runner.getData(); // { reference:'…', total:'…', status:'…' } — the shown values
console.log('Viewing', data.reference);
The same
Runner API works on Print, PDF and
Card pages too — getControl(field).getValue() returns the displayed value.
Full method list in the PP.js reference.