Hi guys.
I want to propose improving the combo config naming—specifically filterParamName. Its current name doesn’t convey that it controls whether the combo queries remotely or locally, unless you read the docs very often.
Developers are more familiar with queryMode: 'local' | 'remote' or maybe even somethign like isRemoteQuery: true/false would be more suggestive than filterParamName.
In real-world apps, filterParamName is usually set once (often to "query") making all combos remote and in few places locally, but seeing in code filterParamName: "", doesn’t suggest it is local mode, and setting a value doesn’t clearly imply remote mode. The code is not readable.
We had to add an override for this to make our devs life easier:
* @config {'local'|'remote'}
* Add "queryMode" config to support ExtJS like "queryMode".
* It updates "filterParamName" accordingly.
* See the "changeStore" ovverride below.
*/
Combo.prototype.queryMode = 'remote';
/**
* @override
* The default implementation does hide the trigger
*/
Combo.prototype.updateFilterParamName = function () {};
/**
* @override
* By default in Bryntum the "filterParamName" determines whether the combo
* is remote or local. But is it is redundant to repeat "filterParamName: 'query'"
* every time. So we better use the "queryMode" instead and update "filterParamName"
* accordingly.
*/
class ComboOverride {
static get target() {
return {
class: Combo,
};
}
/**
* @override
* Update to return 3 (instead of 4) for remote filtering
* @returns {number}
*/
get minChars() {
// If it's nullish, default differently for remote filtering
return this._minChars ?? (this.remoteFilter ? 3 : 1);
}
changeStore(store) {
if (this.queryMode === 'remote') {
this.filterParamName ??= 'query';
}
return this._overridden.changeStore.call(this, store);
}
}
Override.apply(ComboOverride);Thanks
Vadim