I built the screen an interior contractor looks at when closing a job. Two routes: one is the settlement sheet, the other the programme. The first request that came in while moving the sheet onto a screen was simple. Let us change quantities and rates right there.
But a table widget that changes the values itself is a problem. The office ledger is the truth for the closing figure, and the screen is what shows it. The fact that a cell was edited has to go to the ledger, and the table has to redraw with what the ledger gives back. So every widget on this screen follows the same rule. Report what changed and where; do not apply it.
The table only reports an edit
Turn on editable on a dataTable and attach onCellEdit, and an event arrives the moment Enter is pressed in a cell. It carries four things. Which row (event.row, the row object itself), which column (event.column), the new value (event.value) and the previous one (event.previous).
"onCellEdit": {
"type": "batch",
"actions": [
{ "type": "state", "action": "set", "binding": "lastEdit",
"value": "{{event.row.item}} · {{event.column}}: {{event.previous}} → {{event.value}}" },
{ "type": "state", "action": "append", "binding": "edits",
"value": { "item": "{{event.row.item}}", "column": "{{event.column}}",
"from": "{{event.previous}}", "to": "{{event.value}}" } }
]
}
This document only stacks edits into an edits array. It does not touch lines. Change the cabinet quantity from 12 to 14 and the tiling rate from 95 to 98, and the screen looks like this.

Two lines piled up on the right and the amount column on the left did not move. The proof that the widget did not rewrite the row is sitting on the screen. In a real app you would send the edit to the server with a tool action instead of stacking edits, and replace lines with the rows the server returns.
An edit after a sort still names that row
Editing and sorting are used together on the same table. Tap the header of a sortable column and onSort arrives; write the values back into sortColumn and sortAscending and the rows reorder.
{
"type": "dataTable",
"rows": "{{lines}}",
"editable": true,
"sortColumn": "{{sortColumn}}",
"sortAscending": "{{sortAscending}}",
"onSort": { "type": "batch", "actions": [
{ "type": "state", "action": "set", "binding": "sortColumn", "value": "{{event.column}}" },
{ "type": "state", "action": "set", "binding": "sortAscending", "value": "{{event.ascending}}" }
] },
"onCellEdit": { ... }
}
There was one thing to confirm here. After a sort has moved the rows, does an edit report the row that is on screen? The capture above was taken in that order. Sorted by Amount so the cabinets dropped to the bottom, then the quantity on that line was edited; the event reported Cabinet carcasses, and the 14 that was typed stays on that line. On runtime 0.7.7 editable alone did not open a cell, so this could not be checked; it was measured on 0.7.8, where it does.
Formulas read the state
Next to the sheet sits a small spreadsheet. Six lines: contract sum, variations, subtotal, retention, deposit paid, balance due. Formulas went in, not values.
"settlement": [
["Contract sum", { "value": 0, "formula": "contractSum" }],
["Variations", { "value": 0, "formula": "variations" }],
["Subtotal", { "value": 0, "formula": "contractSum + variations" }],
["Retention 5%", { "value": 0, "formula": "round((contractSum + variations) * retention)" }],
["Deposit paid", { "value": 0, "formula": "deposit" }],
["Balance due", { "value": 0, "formula": "contractSum + variations - round((contractSum + variations) * retention) - deposit" }]
]
With formulas: true the runtime evaluates the formula string as a binding expression. There is no separate spreadsheet language with cell addresses; it is the same expression you write inside {{ }}. So what a formula reads is not the neighbouring cell but the page state. Put in contractSum 6374.5, variations 185, retention 0.05 and deposit 2000, and the balance cell shows 4231.52.
formulas defaults to off. A document with nothing to compute has no reason to carry an evaluator, so it is set that way, and the side that needs it says so.
This content requires Developer or above
Sign in and upgrade your plan to continue reading.
View Plans