diff --git a/api/js/etemplate/Et2Select/SearchMixin.ts b/api/js/etemplate/Et2Select/SearchMixin.ts index 8cfb832761..89d0e3b05f 100644 --- a/api/js/etemplate/Et2Select/SearchMixin.ts +++ b/api/js/etemplate/Et2Select/SearchMixin.ts @@ -445,15 +445,17 @@ export const Et2WithSearchMixin = dedupeMixin( protected async _moreResultsTemplate() { - await this.updateComplete; - const moreCount = this._total_result_count - this.select?.querySelectorAll("sl-option.match").length; - if(this._total_result_count <= 0 || moreCount == 0 || !this.select) + if(this._total_result_count <= 0 || !this.select || !this._searchPromise) { return nothing; } - const more = this.egw().lang("%1 more...", moreCount); + return this._searchPromise.then(() => + { + const moreCount = this._total_result_count - this.select?.querySelectorAll("sl-option.match").length; + const more = this.egw().lang("%1 more...", moreCount); - return html`${more}`; + return html`${more}`; + }); } protected _searchInputTemplate() diff --git a/api/src/Etemplate/Widget/Link.php b/api/src/Etemplate/Widget/Link.php index 82b5a06b5f..aac98fa108 100644 --- a/api/src/Etemplate/Widget/Link.php +++ b/api/src/Etemplate/Widget/Link.php @@ -112,7 +112,7 @@ class Link extends Etemplate\Widget $response = Api\Json\Response::get(); // convert associative array to a real array with value attribute, to preserve the order of numeric keys - $response->data(array_values(array_map(static function($key, $value) + $result = array_values(array_map(static function ($key, $value) { if (is_array($value)) { @@ -122,7 +122,12 @@ class Link extends Etemplate\Widget 'value' => $key, 'label' => $value, ]; - }, array_keys($links), $links))); + }, array_keys($links), $links)); + if(array_key_exists('total', $options)) + { + $result['total'] = $options['total']; + } + $response->data($result); } /**