Choose how to deliver a view
Compare single HTML files, sidecar bundles and hosted data by the files each one writes, and learn how CanopyX handles large datasets and exports.
The same view definition can reach readers in three ways. Each tab below shows the call and the files it wrote when this site was built, drawn as a CanopyX tree.
One page with the runtime and the data inline. Attach it, archive it or open it from disk.
using CanopyX;
using CanopyX.Html;
files.SaveHtmlPage("files.html");| Name | Size | Holds |
|---|---|---|
| report/1 file | 713.7 KB | |
| files.html | 713.7 KB | The page: view definition and runtime references |
A page plus data and search files next to it. Branches and search shards load as the reader opens them, with no server.
using CanopyX;
using CanopyX.Html;
files.SaveHtmlBundle("file-report");| Name | Size | Holds |
|---|---|---|
| file-report/25 files | 1 MB | |
| assets/ | 412.7 KB | Runtime script and stylesheet, named by their content |
| canopyx-export.01512af72a298711.js | 11.7 KB | Browser runtime |
| canopyx-highlight.5b6d2e0d979f9f9b.css | 4 KB | Theme stylesheet |
| canopyx-highlight.a6f93893d36ab343.js | 20.4 KB | Browser runtime |
| 12 more files | 376.7 KB | Same kind as the files above |
| data/ | 624.1 KB | Sidecar data, loaded as script files |
| files-4a0699cb…/ | 624.1 KB | One view's data, named by its content |
| p/ (+4) | 515.3 KB | Packs: children pages of many nodes |
| q/ (+2) | 106.4 KB | Index packs: search entries and word shards |
| r/ | 820 B | Pages of the top-level nodes |
| 0.js | 820 B | |
| manifest.js | 1.6 KB | First top-level page, packs and search index |
| index.html | 2.4 KB | The page: view definition and runtime references |
| Showing 14 of 20 rows. | ||
Your application serves the page and answers children, search and counts requests with canopyx/2 documents.
using CanopyX;
using CanopyX.Html;
var files = new CanopyTreeView("files", "Project files");
files.Columns.Add(new CanopyColumn("name", "Name") { Sortable = true });
files.Search = new CanopySearchOptions();
files.Source = CanopySource.Remote(
"api/files/children?ref={ref}&cursor={cursor}",
"api/files/search?q={query}&limit={limit}",
"api/files/counts?ids={ids}");
files.SaveHtmlPage("files.html", new CanopyHtmlOptions { AssetMode = CanopyAssetMode.External });
CanopyHtmlAssets.WriteTo("assets");| Name | Size | Holds |
|---|---|---|
| wwwroot/16 files | 413.7 KB | |
| assets/ | 412.7 KB | Runtime script and stylesheet, named by their content |
| canopyx-export.01512af72a298711.js | 11.7 KB | Browser runtime |
| canopyx-highlight.5b6d2e0d979f9f9b.css | 4 KB | Theme stylesheet |
| canopyx-highlight.a6f93893d36ab343.js | 20.4 KB | Browser runtime |
| 12 more files | 376.7 KB | Same kind as the files above |
| files.html | 1 KB | The page: view definition and runtime references |
| Your endpointscanopyx/2 | ||
| GET api/files/children | A page document of a node's children | |
| GET api/files/search | A search document of id paths | |
| GET api/files/counts | A counts document for loaded nodes |
Tree grids and data grids support all three. A data-grid bundle writes row chunks as sidecar files, so a large grid can open from disk or a file share without a server.
Working with larger datasets
Virtual rows keep the rendered page small. Tree bundles split branches into sidecar files; data-grid bundles split rows into chunks. Hosted sources let your application fetch records as the reader navigates. Flat-grid queries filter and sort the complete dataset before paging; loading one page does not mean the rest of the results are available in the browser.
The file explorer demo is a bundle of more than 100,000 nodes served as static files. Sidecar data files are scripts rather than JSON because browsers block fetch of local files on file://; a script tag loads from a file share, a web server or SharePoint alike.
Exports
CSV export and copying distinguish filtered results, selected records and all records. For Office files, large exports or application actions, connect your own callbacks to the view.
Protocol reference
Hosted sources answer with versioned canopyx/2 documents. The data protocol shows the documents beside the grids they produce.