ComboBoxItem with RestDataSource

Has anyone implemented auto suggest with ComboBox such that everytime the user types on ComboBoxItem, a request is sent to the server ( REST styled)

If I use RESTDataSource, I can only use a static DataURL. But I want to use a custom url everytime for e.g
when the user types a
the url is
/restlet/peopleFinder/a

when the user types aaa
the url is
/restlet/peopleFinder/aaa

How can I achive this?

Right now I am trying to override the addChangedHandler method in the following way but the auto suggest part stops working after I replace the datasource.

comBoxItem.addChangedHandler(new ChangedHandler() {   
public void onChanged(ChangedEvent event) {   
if(event.getValue()!=null && event.getValue().toString().trim().length()>=3){
final Client client = new Client(Protocol.HTTP);
System.out.println("requestSuggestions "+ event.getValue());
client.get("http://localhost:8080/CaseManager/restlet/peoplefinder/"+event.getValue(), new org.restlet.gwt.Callback(){
@Override
public void onEvent(org.restlet.gwt.data.Request requestR, org.restlet.gwt.data.Response responseR) {
try{
DataSource ds = new DataSource();
	ds.setClientOnly(true);
	Document XMLdoc= com.google.gwt.xml.client.XMLParser.parse(responseR.getEntity().getText()) ;
								System.out.println("Result lenght is "+XMLdoc.getElementsByTagName("record").getLength());
								for(int i =0; i<XMLdoc.getElementsByTagName("record").getLength();i++){
									NodeList nl= 
										XMLdoc.getElementsByTagName("record").item(i).getChildNodes();
									ListGridRecord record = new ListGridRecord();
									record.setAttribute("displayName",nl.item(0));
									record.setAttribute("employeeNumber", nl.item(1));
									record.setAttribute("orgUnitDescription",nl.item(2));
									ds.addData(record);
								peopleSearch.setOptionDataSource(ds);
								peopleSearch.setShowOptionsFromDataSource(true);
							}
							catch(Exception e){
								e.printStackTrace();
							}
							
							
						}
					
				});
			}

You can change the dataURL on the fly from within DataSource.transformRequest() by looking at dsRequest.data to get the value from the ComboBox and calling setActionURL() with a new URL based on that value.

Hi,

Is this the easiest way to implement “auto-suggest” ?

Any plans for a native isc implementation for data-bound text entry widgets?

Thanks,
Mike

Just use ComboBoxItem.optionDataSource with any DataSource - can it be more “native” than that?

The previous poster was specifically interested in how to go to a dynamic dataURL. The code he showed is not actually necessary and should be ignored.

Perfect! Thanks…