demo D212
Manufacturing and process in htmx
A machined bore with a tolerance driving capability, drifting in one shift
spec · grid.statistics.capability
This is a machined-bore dataset with a tolerance driving a capability figure, and the process drifting within a single shift. It shows manufacturing data judged against its spec in real time, so a drift out of tolerance shows as it happens.
This is the htmx version. A server-rendered table is upgraded in place, so the page is readable before any script runs and gains the full grid when the module loads, which suits a progressively enhanced app.
The configuration
<link rel="stylesheet" href="https://cdn.latticegrid.dev/lattice-grid@1.108.0/lattice-grid.min.css">
<!-- A real, server-rendered table: readable with JavaScript off. data-field on
each header names the column that cell becomes, and data-id on each row is
the key the grid carries it under. -->
<table id="production-line-table" data-lattice-grid>
<thead>
<tr>
<th data-field="part">Part</th>
<th data-field="shift">Shift</th>
<th data-field="bore">Bore</th>
<th data-field="speed">Spindle</th>
<th data-field="line">Line pressure</th>
<th data-field="torque">Torque</th>
</tr>
</thead>
<tbody>
<tr data-id="1"><td>P0001</td><td>Shift 1</td><td>9.935</td><td>13602</td><td>4.0544</td><td>25.9</td></tr>
<tr data-id="2"><td>P0002</td><td>Shift 1</td><td>9.986</td><td>11251</td><td>5.5766</td><td>107.1</td></tr>
<tr data-id="3"><td>P0003</td><td>Shift 1</td><td>9.883</td><td>10301</td><td>6.3551</td><td>174.4</td></tr>
<!-- the rest of the rows, rendered by your server -->
</tbody>
</table>
<script type="module">
import { hydrateTable } from 'https://cdn.latticegrid.dev/lattice-grid@1.108.0/modules/htmx.esm.min.js';
// The markup carries the rows; a server-rendered table's column types are
// declared in the config hydrateTable takes. The grid replaces the table
// where it stood.
const grid = hydrateTable(document.getElementById('production-line-table'), {
toolPanel: { side: 'left', panels: ['columns', 'filters', 'statistics'] },
columnDefaults: { filter: true },
columns: [
{ field: 'part', title: 'Part', layout: { pin: 'start', width: 120 } },
{ field: 'shift', title: 'Shift', filter: { type: 'set' } },
// The spec drives process capability and the control chart.
{ field: 'bore', title: 'Bore', type: 'millimetres', total: 'median',
spec: { lower: 9.5, upper: 10.8, target: 10 } },
{ field: 'speed', title: 'Spindle', type: 'rpm', total: 'avg' },
{ field: 'line', title: 'Line pressure', type: 'bar', total: 'p95' },
{ field: 'torque', title: 'Torque', type: 'torque', total: 'max' },
],
});
</script>