You need to call super(model) in your constructor so that your model will be used.
Steve On Mon, Apr 10, 2017 at 6:56 AM, steve nganga <[email protected]> wrote: > 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%3DW1NRG8mOBdagxj2dcwPPYjfMCBH4 > spwwtFMyZrKV6A%40mail.gmail.com > <https://groups.google.com/d/msgid/codenameone-discussions/CAOfyKqa%3DW1NRG8mOBdagxj2dcwPPYjfMCBH4spwwtFMyZrKV6A%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- Steve Hannah Software Developer Codename One http://www.codenameone.com -- 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/CAGOYrKXJ2e-Y%2B%2B2WNf3Bi0PokOCY2kstk2s8qSfcKNXEuhAFVA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
