demo D141
Licence and the trial watermark in htmx
What an unlicensed grid does, and the loopback exemption
config.licence · grid.licence
This page shows what an unlicensed grid does, including the trial watermark and the exemption for local development. It sets out the per-domain licensing plainly, so you know how the grid behaves with and without a key before you ship.
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="licence-and-watermark-table" data-lattice-grid>
<thead>
<tr>
<th data-field="question">Asked of the grid</th>
<th data-field="meaning">What it means</th>
</tr>
</thead>
<tbody>
<tr data-id="1"><td>grid.licence.state()</td><td>'licensed', 'localhost' or 'trial'. Only the third is watermarked.</td></tr>
<tr data-id="2"><td>grid.licence.watermark()</td><td>Whether the renderer should paint the trial mark over this grid.</td></tr>
<tr data-id="3"><td>grid.licence.info().valid</td><td>False here, because the key below is deliberately not a real one.</td></tr>
<!-- the rest of the rows, rendered by your server -->
</tbody>
</table>
<script type="module">
import * as LatticeGrid from 'https://cdn.latticegrid.dev/lattice-grid@1.108.0/modules/htmx.esm.min.js';
const grid = LatticeGrid.hydrateTable(document.getElementById('licence-and-watermark-table'), {
// Your key. Installed on the process-wide holder, so it sets the licence
// state for the whole document. A licence removes the trial mark; every
// feature is available either way, and localhost needs no key at all.
licence: 'LG1...your-key',
columns: [
{ field: 'question', title: 'Asked of the grid', layout: { width: 250, pin: 'start' } },
{
id: 'answer',
title: 'Answer in your browser',
layout: { width: 220 },
sort: false,
filter: false,
// Read from the grid that is displaying it, so the readout cannot drift
// from what this page is actually doing.
value: {
pure: false,
deps: '*',
compute: (_deps, ctx) => {
const grid = ctx?.grid;
switch (ctx?.data?.id) {
case 1: return String(grid?.licence?.state?.() ?? 'no licence api');
case 2: return String(grid?.licence?.watermark?.() ?? 'no licence api');
case 3: return String(grid?.licence?.info?.()?.valid ?? 'no licence api');
case 4: return String(grid?.licence?.info?.()?.reason ?? '(none)');
case 5: return String(location?.hostname || '(no host)');
case 6: return typeof LatticeGrid.isLocalHost === 'function'
? String(LatticeGrid.isLocalHost()) : 'not exported';
case 7: return typeof LatticeGrid.licenceState === 'function'
? String(LatticeGrid.licenceState()) : 'not exported';
default: return '';
}
},
},
},
{ field: 'meaning', title: 'What it means', layout: { flex: 1, min: 300 }, cell: { wrap: true } },
],
});
</script>
Trial watermarking and the domain licence
Lattice Grid is licensed per domain: a key issued for app.example.com validates on that hostname only (every subdomain counts as its own domain, and a wildcard key for *.example.com covers the domain and all its subdomains), and the grid checks it once at construction rather than on every render. Without a matching key, or during evaluation, the grid still runs at full capability, but draws a diagonal watermark across the body and stamps one into CSV and Excel exports, so a trial build is obvious wherever it is used or shared, not just on screen. Reach for config.licence when embedding the key at build or deploy time, and for grid.licence when an application needs to set or replace it after the grid already exists, for instance in a multi-tenant admin tool that swaps keys per customer at runtime. A localhost and loopback exemption means development on 127.0.0.1 or localhost never shows the watermark regardless of licence state, so a missing or misconfigured key is caught in staging or production rather than on every developer’s own machine. The watermark itself is a layer drawn independently of row and column virtualisation, so it costs nothing per scroll frame and does not participate in cell recycling.
Does an unlicensed Lattice Grid stop working?
No. An unlicensed or trial grid keeps its full feature set: sorting, filtering, editing, export and every renderer behave identically to a licensed one. The only difference is a watermark overlaid on the grid and carried into CSV and Excel exports, set through config.licence or grid.licence. A valid domain key removes it; localhost and loopback origins are exempt while developing.
The non-commercial key
A personal project, teaching, research or an open-source project that is not itself a product does not need a paid key to lose the watermark. Get the non-commercial key, six months for one domain, renewable at no charge for as long as the project stays non-commercial.