1 Reply Latest reply on Jun 19, 2007 8:30 AM by Ilya Shaikovsky

    SuggestionBox example

    Nicolas Chessel Newbie

      HI! i m a beginner in that kind of developpement, richfaces i mean... i just need to find a good exemple to start well,
      i did once, but i could not understand what is exactly the type of object "Data",

      public List autocomplete(Object suggest) {
       String pref = (String)suggest;
       ArrayList result = new ArrayList();
      
       Iterator iterator = getAllData().iterator();
       while (iterator.hasNext()) {
       Data elem = (Data) iterator.next();
       if ((elem != null && elem.getText().toLowerCase().indexOf(pref.toLowerCase()) == 0) || "".equals(pref))
       {
       result.add(elem);
       }
       }
       return result;
       }
      
       public ArrayList getCities() {
       return cities;
       }
      
       public void setCities(ArrayList cities) {
       this.cities = cities;
       }
      
       public ArrayList getAllData() {
       ArrayList result = new ArrayList();
       for (int i = 0; i < cit.length; i++) {
       Data data = new Data(cit, String.valueOf(i + 1));
       result.add(data);
       }
       return result;
       }
      


      so if someone can explain me this or give a good link for suggestion box example, it will be just so great!!!