ComboBoxItem minimum search limit

SmartGwt 2.4
IE8

Hi,

I have a ComboBoxItem pointing at an optionDatasource. The database table behind the optionDatasource has a large amount of records (3.6 million). Is it possible to put a limit similar to the FetchDelay time so not send a request less than 3 characters?

I am aware I could enfore this in my backend would prefer not to due to providing a common interface to external systems and I am reluctant to create more than one resource for a single db table. Additionaly I would prefer not to make requests which are ignored.

Thanks,

Ben

For anyone else reading this I’ve made two attempts to fix the problem

comboBoxItem.addChangedHandler(new ChangedHandler(){
	@Override
	public void onChanged(ChangedEvent event) {
		ComboBoxItem cbi =((ComboBoxItem) event.getSource());
		if (event.getValue()!=null && String.valueOf(event.getValue()).length()>=3){
			cbi.setShowPickListOnKeypress(true);
		} else {
			cbi.setShowPickListOnKeypress(false);
		}
	}
});

This works in that it waits until the string has 3 chars but the cbi.setShowPickListOnKeypress(false) doesnt work for turning it off.

The other attempt is to manage the pickListCriteria myself and only change it when the length is >3 then call fetchData on the CBI manually. However as this had the overhead of doing a call on every keypress I thought the above is a better temporary solution.

Not the cleanest solution, but one approach would be to implement a transformRequest handler that provides a stubbed response if the criteria is too short. You would provide the response via switching to dataProtocol:“clientCustom” on the fly. The response could contain a record whose data value is “Please enter 3 or more characters to see results” so the user knows what’s going on.

SmartGWT 4.0d and SmartClient 9.0d builds, available from smartclient.com/builds, now have
support for ComboBoxItem.minimumSearchLength.