From fe32873621b70923da59f0587d8d9720d35711cd Mon Sep 17 00:00:00 2001 From: Tobias Klika Date: Tue, 26 Apr 2022 11:55:48 +0200 Subject: [PATCH] allow custom titles for list column images --- zero.Backoffice.UI/app/schemas/list/list-column.ts | 11 +++++++---- zero.Backoffice.UI/index.html | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/zero.Backoffice.UI/app/schemas/list/list-column.ts b/zero.Backoffice.UI/app/schemas/list/list-column.ts index 8932d0d3..ce3ee1bb 100644 --- a/zero.Backoffice.UI/app/schemas/list/list-column.ts +++ b/zero.Backoffice.UI/app/schemas/list/list-column.ts @@ -195,14 +195,15 @@ class ListColumn /** * Output an image by using the value media ID + * @param {function} [titleFunc] - Custom function to render a title * @returns {ListColumn} */ - image() + image(titleFunc: any = null) { this._type = 'image'; this._asHtml = true; - // TODO correct app ID - this._func = (value, opts) => + this._funcOptions = { titleFunc }; + this._func = (value, opts, model) => { let id = value; @@ -216,7 +217,9 @@ class ListColumn return ''; } - return ``; + let title = typeof opts.titleFunc == 'function' ? opts.titleFunc(value, model) : ''; + + return ``; }; return this; } diff --git a/zero.Backoffice.UI/index.html b/zero.Backoffice.UI/index.html index eebbc9dd..1090f954 100644 --- a/zero.Backoffice.UI/index.html +++ b/zero.Backoffice.UI/index.html @@ -20,7 +20,7 @@ - +