I am fetching data from the the database and can even print the data on the overridden filter method of the AutoCompleteTextField. The issue is that even after adding the newly fetched items in the DefaultListModel.. the items are not being displayed in the in the popup of the autoComplete. What could be the issu
Here is my Code.
import com.codename1.ui.AutoCompleteTextField;
import com.codename1.ui.list.DefaultListModel;
public class AutoCompleteUI extends AutoCompleteTextField {
private DefaultListModel dlm;
public AutoCompleteUI(DefaultListModel model) {
this.dlm = model;
setMinimumElementsShownInPopup(5);
}
@Override
public boolean filter(String text) {
if (text.trim().length() == 0) {
return false;
}
try
{
String data[]=ConnectionUtil.getResultsFromDB(text);
dlm.removeAll();
if(data==null || data.length==0)
return false;
for(String res:data)
{
System.out.println(res);
dlm.addItem(res);
}
return true;
}catch(Exception io)
{
io.printStackTrace();
}
return false;
}
}