{"action":"opened","issue":{"url":"https://api.github.com/repos/codenameone/CodenameOne/issues/1694","repository_url":"https://api.github.com/repos/codenameone/CodenameOne","labels_url":"https://api.github.com/repos/codenameone/CodenameOne/issues/1694/labels{/name}","comments_url":"https://api.github.com/repos/codenameone/CodenameOne/issues/1694/comments","events_url":"https://api.github.com/repos/codenameone/CodenameOne/issues/1694/events","html_url":"https://github.com/codenameone/CodenameOne/issues/1694","id":134874424,"number":1694,"title":"It's too hard/impossible to create a truly dynamic AutoCompleteTextField","user":{"login":"codenameone","id":2353641,"avatar_url":"https://avatars.githubusercontent.com/u/2353641?v=3","gravatar_id":"","url":"https://api.github.com/users/codenameone","html_url":"https://github.com/codenameone","followers_url":"https://api.github.com/users/codenameone/followers","following_url":"https://api.github.com/users/codenameone/following{/other_user}","gists_url":"https://api.github.com/users/codenameone/gists{/gist_id}","starred_url":"https://api.github.com/users/codenameone/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codenameone/subscriptions","organizations_url":"https://api.github.com/users/codenameone/orgs","repos_url":"https://api.github.com/users/codenameone/repos","events_url":"https://api.github.com/users/codenameone/events{/privacy}","received_events_url":"https://api.github.com/users/codenameone/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-02-19T14:10:51Z","updated_at":"2016-02-19T14:10:51Z","closed_at":null,"body":"With the webservice defined here:\r\n\r\n````java\r\n    java.util.List<Map<String, Object>> searchLocations(String text) {        \r\n        try {\r\n            ConnectionRequest r = new ConnectionRequest();\r\n            r.setPost(false);\r\n            r.setUrl(\"http://api.nestoria.co.uk/api\");\r\n            r.addArgument(\"pretty\", \"0\");\r\n            r.addArgument(\"action\", \"search_listings\");\r\n            r.addArgument(\"encoding\", \"json\");\r\n            r.addArgument(\"listing_type\", \"buy\");\r\n            r.addArgument(\"page\", \"1\");\r\n            r.addArgument(\"country\", \"uk\");\r\n            r.addArgument(\"place_name\", text);        \r\n            NetworkManager.getInstance().addToQueueAndWait(r);\r\n            Map<String,Object> result = new JSONParser().parseJSON(new InputStreamReader(new ByteArrayInputStream(r.getResponseData()), \"UTF-8\"));\r\n            Map<String, Object> response = (Map<String, Object>)result.get(\"response\");\r\n            List<Map<String, Object>> results = (List<Map<String, Object>>)response.get(\"locations\");\r\n            return results;\r\n        } catch(Exception err) {\r\n            Log.e(err);\r\n            return null;\r\n        }\r\n    }\r\n````\r\nI would expect this `AutoCompleteTextField` to work but it doesn't:\r\n\r\n````java\r\n        Form hi = new Form(\"Auto Complete\", new BoxLayout(BoxLayout.Y_AXIS));\r\n        final DefaultListModel<String> options = new DefaultListModel<>();\r\n        AutoCompleteTextField ac = new AutoCompleteTextField(options) {\r\n            @Override\r\n            protected boolean filter(String text) {\r\n                if(text.length() == 0) {\r\n                    return false;\r\n                }\r\n                java.util.List<Map<String, Object>> l = searchLocations(text);\r\n                if(l == null || l.size() == 0) {\r\n                    return false;\r\n                }\r\n                \r\n                options.removeAll();\r\n                for(Map<String, Object> o : l) {\r\n                    options.addItem((String)o.get(\"place_name\"));\r\n                }\r\n                return true;\r\n            }\r\n            \r\n        };\r\n        ac.setMinimumElementsShownInPopup(5);\r\n        hi.add(ac);\r\n````\r\nI think we need to rewrite the component to provide an option that doesn't use a list (e.g. for more customizability) and to provide better dynamic fill."}}