Request new features or modifications


Post by vadim_g »

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


Post by Animal »

What is the difference?

filterParamName : 'query'

or

remote : true.
filterParam : 'query'

I mean you have to tell it the query parameter name anyway, so it is the remote property which is redundant (meaning it conveys no new information)


Post by vadim_g »

Hi Animal,

Yes, 2 configs - that's the difference. But by default being like that, it would mean only to set in application where is needed just remote: false and that's it, so in the end is just 1 config. It's remote: false vs filterParam : '', surely first one is more readable.

Note: filterParam: 'query' is unique and set once.

Vadim.


Post by tasnim »

Thanks for your feedback on the filterParamName configuration.

Just to clarify — filterParamName is indeed the name of the HTTP parameter that carries the filters when making requests to the server. If this config is set to a non-null value, it’s used for remote filtering. If it’s not set, filters won’t be sent to the server, and filtering will instead happen locally.

I hope this clears things up, but if you still have concerns or ideas, we’re happy to continue the discussion :).

Best regards,
Tasnim

How to ask for help? Please read our Support Policy


Post by vadim_g »

Yes, we know. Consider above where filterParamName: "" should be null then.


Post by tasnim »

Yes :) filterParamName : null if you don't want it remote

Best regards,
Tasnim

How to ask for help? Please read our Support Policy


Post Reply