Mercurial > packages > framework
diff publishable/resources/js/ServerTable.js @ 7:e6132a1e8e24 default tip
Adding better support for test among other base changes.
| author | Luka Sitas <sitas.luka.97@gmail.com> |
|---|---|
| date | Thu, 25 Sep 2025 19:58:32 -0400 |
| parents | 6ded573b0a61 |
| children |
line wrap: on
line diff
--- a/publishable/resources/js/ServerTable.js Tue Sep 09 15:49:54 2025 -0400 +++ b/publishable/resources/js/ServerTable.js Thu Sep 25 19:58:32 2025 -0400 @@ -8,6 +8,7 @@ * @param {Array} [options.initialSort=[]] - Default sort: [{col, dir}] * @param {Object} [options.headers={}] - Additional headers for requests * @param {string} [options.groupBy={}] - Which column to group by + * @param {Function} [options.postRender={}] - Function to call after rendering * @param {Function} [options.groupRender={}] - Function to render the grouping */ constructor(rootEl, options) { @@ -20,6 +21,7 @@ this.currentPage = 1; this.headers = options.headers || {}; this.groupBy = options.groupBy; + this.postRender = options.postRender || null ; this.groupRender = options.groupRender || ((g, rows) => @@ -201,7 +203,9 @@ ) .join(""); } + if(typeof this.postRender === "function") this.postRender(); } + renderError() { this.tbody.innerHTML = `<tr><td colspan="${this.columns.length}" style="color:red">${this.state.error}</td></tr>`; }
