mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-22 23:00:56 +01:00
Api: SearchMixin improvements to work with Et2LinkSearch more efficiently
Moving handling of missing options to overridable method so Et2LinkSearch can use its more efficient method
This commit is contained in:
parent
06af22a46c
commit
2a5d0062dd
@ -591,19 +591,34 @@ export const Et2WithSearchMixin = <T extends Constructor<LitElement>>(superclass
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Given a value we need to search for - this will add in all matches, including the one needed
|
this._missingOption(newValueElement);
|
||||||
this.remoteSearch(newValueElement, this.searchOptions).then((result : SelectOption[]) =>
|
|
||||||
{
|
|
||||||
const option = <SelectOption>result.find(o => o.value == newValueElement);
|
|
||||||
if(option)
|
|
||||||
{
|
|
||||||
this._selected_remote.push(option);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Some [part of a] value is missing from the available options, but should be there, so find and add it.
|
||||||
|
*
|
||||||
|
* This is used when not all options are sent to the client (search, link list). Ideally we want to send
|
||||||
|
* the options for the current value, but sometimes this is not the best option so here we search or create
|
||||||
|
* the option as needed. These are not free entries, but need to match some list somewhere.
|
||||||
|
*
|
||||||
|
* @param {string} newValueElement
|
||||||
|
* @protected
|
||||||
|
*/
|
||||||
|
protected _missingOption(newValueElement : string)
|
||||||
|
{
|
||||||
|
// Given a value we need to search for - this will add in all matches, including the one needed
|
||||||
|
this.remoteSearch(newValueElement, this.searchOptions).then((result : SelectOption[]) =>
|
||||||
|
{
|
||||||
|
const option = <SelectOption>result.find(o => o.value == newValueElement);
|
||||||
|
if(option)
|
||||||
|
{
|
||||||
|
this._selected_remote.push(option);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
protected fix_bad_value()
|
protected fix_bad_value()
|
||||||
{
|
{
|
||||||
if(!this.allowFreeEntries && !this.searchEnabled)
|
if(!this.allowFreeEntries && !this.searchEnabled)
|
||||||
|
Loading…
Reference in New Issue
Block a user