Following is the method i have employed to accomplish this.
Id for the element would be created by the server and a map will keep track of the size of each typeahead instance.
On restart following code is executed to find the largest ID and this value is stored to the above map.
public int getLargest(ArrayStoreElement<E> store) {
int largest=0;
int start = store.getIndexStart();
int end = start + store.length();
for(int i = start; i < end; i++) {
E element = store.getElement(i);
if(element != null && ((ElementDTO) element).isSearchable()) {
if(largest < i){
largest=i;
}
}
}
return largest;
}
Is there a better way to generate ID.
Thanks
Vineeth