No results
Try different search terms.
Applied to a table container via <div data-ln-table id="..."> or <table>, ln-table operates in two distinct modes. In SSR mode, it indexes server-rendered <tbody> rows, intercepting ln-search, ln-filter, and ln-sort CustomEvents to toggle .hidden on <tr> elements or reorder rows in the DOM. In data-driven mode (data-ln-table-source="store"), it listens for ln-data-store:data events, clones <template data-ln-table-row>, populates cells via fill(), and mounts rendered rows into <tbody> with sliding-window virtual scrolling.
In web application design, data grids can often be pre-rendered completely on the server. In these scenarios, introducing a heavy client-side JSON-to-HTML template rendering pipeline is unnecessary overhead. The DOM already contains the correct HTML rows on initial load.
Instead of generating rows dynamically, ln-table parses existing DOM rows directly on paint. It layers ultra-fast, in-memory client-side sorting, column filtering, text searches, and virtual scroll on top of standard pre-rendered HTML, providing a fluid desktop-grid experience with zero database fetching overhead.
Unlike data tables (which consume raw JSON via event streams), ln-table expects standard rows (<tr>) already printed in <tbody> on page load. It acts as an upgrade node: parsing cell texts dynamically and hiding or sorting DOM elements in-place. The HTML DOM is the single source of truth.
ln-table): The script acts as an enhancement node. It scans cells, parses raw values (using optional data-ln-value attributes), manages in-memory sort orders, and hides rows dynamically using filter criteria.
data-ln-value targets into highly-optimized search and sort indexes in memory.data-ln-search-for) or clicks a sort header (data-ln-sort), the component executes in-memory, local array filters instantly.For the full guide see the ln-table README and the architecture reference.
| Attribute | On element | Description |
|---|---|---|
data-ln-table | wrapper (needs id) | Component root. Parses rows, listens for events. |
data-ln-search-for="tableId" | <input> or wrapper | Control pointer to table ID. ln-table intercepts the event for in-memory filtering. |
data-ln-table-clear | <button> | Clears search input. |
data-ln-sort="tableId" | <ul> inside <th> | Sort control. Type is auto-detected at sort time — no type attribute needed. |
td[data-ln-value] | <td> | Raw sort value when display text differs. |
data-ln-table-filter-col="key" | <th> | Maps column to a filter key (used by ln-filter). |
data-ln-table-empty | <template> | Content shown when filter returns 0 results. |
Try different search terms.
|
#
|
Product
|
Category
|
Price
|
Stock
|
Status
|
|---|---|---|---|---|---|
| 1 | Laptop Pro 15 | Electronics | 1499 | 120 | In Stock |
| 2 | Wireless Mouse M1 | Peripherals | 29 | 450 | In Stock |
| 3 | USB-C Hub Multiport | Peripherals | 59 | 85 | In Stock |
| 4 | Mechanical Keyboard RGB | Peripherals | 129 | 40 | Low Stock |
| 5 | Monitor 27" 4K UHD | Electronics | 499 | 15 | Low Stock |
| 6 | Webcam HD 1080p | Peripherals | 79 | 0 | Out of Stock |
| 7 | Headset Pro Wireless | Accessories | 199 | 210 | In Stock |
| 8 | Docking Station Dual 4K | Accessories | 249 | 60 | In Stock |
| 9 | SSD 1TB NVMe PCIe4 | Storage | 119 | 310 | In Stock |
| 10 | RAM 32GB DDR5 Kit | Components | 159 | 95 | In Stock |
| 11 | GPU Card RTX 4070 | Components | 699 | 8 | Low Stock |
| 12 | Network Switch 24-Port | Networking | 299 | 22 | Low Stock |
| 13 | Power Supply 850W Gold | Components | 139 | 140 | In Stock |
| 14 | Cable Kit Modular sleeve | Accessories | 39 | 500 | In Stock |
| 15 | Mouse Pad XL Desk Mat | Accessories | 19 | 0 | Out of Stock |
| 16 | Screen Protector 27" | Accessories | 25 | 180 | In Stock |
| 17 | Router Wi-Fi 6E Pro | Networking | 229 | 45 | Low Stock |
| 18 | External HDD 4TB USB3 | Storage | 99 | 120 | In Stock |
| 19 | Microphone USB Studio | Accessories | 149 | 75 | In Stock |
| 20 | Ergonomic Office Chair | Accessories | 349 | 12 | Low Stock |
| Event | Dispatched by | detail |
|---|---|---|
ln-table:ready | ln-table — after row parse | { total } |
ln-table:filter | ln-table — after filter render | { term, matched, total } |
ln-table:sorted | ln-table — after sort render | { column, direction, matched, total } |
ln-table:empty | ln-table — filter returns 0 | { term, total } |
When display text differs from the sort key:
<!-- Without: sorts by "1.250" (string) -->
<td>1.250</td>
<!-- With: sorts by 1250 (number) -->
<td data-ln-value="1250">1.250</td>
<!-- Date: sorts by Unix timestamp -->
<td data-ln-value="1700000000">15.11.2023</td>
Activates when filtered rows exceed 200. Renders only visible rows + 15 buffer rows above/below. Deactivates automatically when rows drop below threshold. Column widths are locked on first parse to prevent layout shifts.
If <tbody> is empty at init, a MutationObserver waits for rows to appear and parses them automatically.
// Manual init
window.lnTable(document.body);
// Instance
var el = document.querySelector('[data-ln-table]');
el.lnTable.destroy(); // remove listeners, virtual scroll, column locks