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
Screenshot below
[image: Inline image 1]
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;
}
}
Where the Component is added
DefaultListModel<String> dlm=new DefaultListModel<>();
AutoCompleteUI vp=new AutoCompleteUI(dlm);
--
You received this message because you are subscribed to the Google Groups
"CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
Visit this group at https://groups.google.com/group/codenameone-discussions.
To view this discussion on the web visit
https://groups.google.com/d/msgid/codenameone-discussions/CAOfyKqa%3DW1NRG8mOBdagxj2dcwPPYjfMCBH4spwwtFMyZrKV6A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.