Hello,
The story is this: I want to create a dynamic suggestion/autocomplete feature to a comboboxitem.
In this item i have setted a ds with which i fetch data when the keypress event is triggered. Also i have setted the comboboxitem's setFilterLocally and setUseClientFiltering to true. The method i use to fetch data is usernameComboBoxItem.fetchdata(DSCallback). Inside the callback i want to get the records that where returned from the ds but i get null instead. I have added the code below
Thanks in advance
The story is this: I want to create a dynamic suggestion/autocomplete feature to a comboboxitem.
In this item i have setted a ds with which i fetch data when the keypress event is triggered. Also i have setted the comboboxitem's setFilterLocally and setUseClientFiltering to true. The method i use to fetch data is usernameComboBoxItem.fetchdata(DSCallback). Inside the callback i want to get the records that where returned from the ds but i get null instead. I have added the code below
Thanks in advance
Code:
ComboBoxItem usernameItem = new ComboBoxItem("usernameField", "Username"); usernameItem.setAutoFetchData(false); usernameItem.setFilterLocally(true); usernameItem.setUseClientFiltering(true); usernameItem.addChangedHandler(new ChangedHandler() { @Override public void onChanged(ChangedEvent event) { ComboBoxItem userNameItem = (ComboBoxItem) event.getItem(); if (userNameItem.getOptionDataSource() != null) userNameItem.getOptionDataSource().destroy(); userNameItem.setOptionDataSource( new GetSearchUserDS(event.getValue().toString(),ServerNames.getDefault().getName())); userNameItem.fetchData(new DSCallback() { @Override public void execute(DSResponse dsResponse, Object data, DSRequest dsRequest) { GWT.log(dsResponse.getDataAsString()); } });
Comment