0

I have a RPC method that returns a List of Strings. I want to create a ComboBox with a store that will load the values through a RpcProxy, but I can't find an example that doesn't use some sort of ModelData class.

I would prefer not to have to create a simple Bean with only one property (the string) and then have to convert the List one item at a time.

My ideal would be to create something like this:

RpcProxy<List<String>> proxy = new RpcProxy<List<String>>()...

Any suggestions?

NestorDRod
  • 166
  • 1
  • 14

1 Answers1

1

Unfortunately, with GXT 2.2.5, you can't get around not using ModelData.

The class definition for ComboBox says it all:

public class ComboBox<D extends ModelData> extends TriggerField<D> implements SelectionProvider<D> {
...
protected ListStore<D> store;
...

So, at this point your biggest concern is keeping your code clean. If you have to make a specialized ModelData derived class, you could subclass ComboBox and keep a nested class definition for your wrapper object.

If you're not tied to using GXT 2.2.5, I would update to GXT 3.0.x and GWT 2.5.0. GXT 3 moved away from using ModelData. Now, everything accepts bean-like objects.

Jonathan
  • 705
  • 5
  • 16
  • Thanks for the response. Unfortunately, I am stuck with 2.2.5 due to other dependencies. It would be such a help if I could use SimpleComboValue as my ModelData, but I can't instantiate one because the constructor is not public, so I'm left with either subclassing it or creating my own model. Six of one, half a dozen of the other. – NestorDRod Feb 18 '13 at 16:36
  • You can mix and match GXT 2.2.5 and GXT 3.0.0. But be wary of z-indexing issues. – Jonathan Feb 18 '13 at 17:26