How to make the LookupEditor case insensitive, the DB has values that are like so "un" and "UN" and I want to both be binding because the database is case insensitive.
Any suggestions ?
You can try to make a Lookup editor and override query option of select2Options...
For example
namespace YourNamespace {
@Serenity.Decorators.registerEditor()
export class ExtLookup extends Serenity.LookupEditorBase<ExtLookupOptions, any> {
constructor(container: JQuery, opt?: ExtLookupOptions) {
super(container, opt);
}
public getSelect2Options() {
var selec2Options = super.getSelect2Options();
selec2Options.query = this.queryCustom;
}
protected queryCustom(p1: Select2QueryOptions) {
var term = (Q.isEmptyOrNull(p1.term) ? '' : Select2.util.stripDiacritics(Q.coalesce(p1.term, '')).toUpperCase());
var results = (this as any).data.filter((item) => {
[ADD YOUR LOGIC HERE]
}
var res: Select2Result = {
results: results.slice((p1.page - 1) * 100 /*this.pageSize*/, p1.page * 100/*this.pageSize*/),
more: results.length >= p1.page * 100/*this.pageSize*/,
context: p1.context
}
p1.callback(res);
}
Thanks :)
Most helpful comment
You can try to make a Lookup editor and override query option of select2Options...
For example