Et2Select fixes

- Fix sometimes not shown emptyLabel
 - Fix LinkSearch result count
This commit is contained in:
nathan 2023-11-16 15:05:38 -07:00
parent 2b7f4ae5ee
commit 9f46ee5e62
3 changed files with 36 additions and 22 deletions

View File

@ -11,7 +11,6 @@ import {css} from "lit";
import {Et2Select} from "../Et2Select/Et2Select";
import {Et2LinkAppSelect} from "./Et2LinkAppSelect";
import {Et2Link} from "./Et2Link";
import {cleanSelectOptions} from "../Et2Select/FindSelectOptions";
export class Et2LinkSearch extends Et2Select
{
@ -75,9 +74,7 @@ export class Et2LinkSearch extends Et2Select
}
return request.then((result) =>
{
const entries = cleanSelectOptions(result);
this.processRemoteResults(entries);
return entries;
return this._processResultCount(result);
});
}

View File

@ -419,6 +419,10 @@ export class Et2Select extends Et2WithSearchMixin(Et2WidgetWithSelect)
{
this.__value = this.__value != "" ? [this.__value] : [];
}
else if(!this.multiple && Array.isArray(this.__value))
{
this.__value = this.__value.toString();
}
if(this.select)
{
this.select.value = this.__value;

View File

@ -1251,6 +1251,20 @@ export const Et2WithSearchMixin = dedupeMixin(<T extends Constructor<LitElement>
}
return this.egw().request(this.egw().link(this.egw().ajaxUrl(this.egw().decodePath(this.searchUrl)),
{query: search, ...sendOptions}), [search, sendOptions]).then((results) =>
{
return this._processResultCount(results);
});
}
/**
* Update total result count, checking results for a total attribute, then further processing the results
* into select options
*
* @param results
* @returns {SelectOption[]}
* @protected
*/
protected _processResultCount(results)
{
// If results have a total included, pull it out.
// It will cause errors if left in the results
@ -1270,7 +1284,6 @@ export const Et2WithSearchMixin = dedupeMixin(<T extends Constructor<LitElement>
this._total_result_count -= this.processRemoteResults(entries);
return entries;
});
}
/**