I’m having problems with ModelComparer. Here is the code:
mycombobox.getStore().setModelComparer(new ModelComparer<BeanModel>() {
@Override
public boolean equals(BeanModel m1, BeanModel m2) {
System.out.println("HEY.");
if(m1 == null) return false;
if(m2 == null) return false;
return (((mycomboelement)m1.getBean()).getId()==((mycomboelement)m2.getBean()).getId());
}
});
The ModelComparer I defined does not work at all. When I call
abeanmodel = mycombobox.getStore().findModel(x);
the variable abeanmodel is always null, neither the message “HEY.” is printed on console. I can’t figure out what’s wrong. I’m using gxt-2.2.3. TIA.
Francesco
I got the answer. Terrel was right. I’ve to post some more code.
When I execute:
I check my
BeanModel xagainst an empty store. That’s because of GWT’s asynchronous call execution. To get the code working I have to implement aLoadListener:now I’m sure to check my
BeanModel xagainst a store filled with data.I hope this helps. Thank you.
Francesco