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;
}
data is just an object defined in another class. :)
please Explore wiki and found the links to our demo-site sources.
And you can see the site at http://livedemo.exadel.com/richfaces-demo/