PDA

View Full Version : Need PagingLoadResult but get List from Server



schube
22 Jul 2009, 6:03 AM
Hello!

I am new to GXT and I am facing the following problem:

My service returns a "List<Incidents>":


@RemoteServiceRelativePath("incident")
public interface IncidentService extends RemoteService {
List<Incident> getIncidents(int offset, int pagesize);
}
and


public interface IncidentServiceAsync {
void getIncidents(int offset, int pagesize, AsyncCallback<List<Incident>> callback);
}
I am NOT using "PagingLoadResult" in my service on purpose, because I want to keep it generic. But when using the result in a client, I want to use it in a paged grid.

This is the current, none-working client code:


RpcProxy<PagingLoadResult<Incident>> proxy = new RpcProxy<PagingLoadResult<Incident>>() {
@Override
protected void load(Object loadConfig,
AsyncCallback<PagingLoadResult<Incident>> callback) {
service.getIncidents(0, 20, callback);

}
};
The problem is obvious: "callback" is defined as "AsyncCallback<PagingLoadResult<Incident>>" here and as "AsyncCallback<List<Incident>>" in the service.
What must I do, to get this working? How can I typecast that?

Thank you,
Bernhard

Grandma78
27 Aug 2009, 2:18 AM
have the same problem... any ideas?

Arno.Nyhm
27 Aug 2009, 8:26 AM
i would try to make a RpcProxy<List<Incident>> and add a reader which convert it to your PagingLoadResult<Incident> but i dont know if it is the right way.

schube
27 Aug 2009, 9:11 AM
Hi!

I was not able to fix the problem and I am using the whole PageConfig object now.

Greetings!