PDA

View Full Version : ListField and BeanModel



r4nd7263
12 Oct 2011, 5:26 AM
How do I set the display field if I use BeanModel for my ListField store?

I tried field.setDisplayField("bean.label");, but got JavaScriptException: (TypeError): 'bean' is undefined.

r4nd7263
12 Oct 2011, 10:06 AM
Nevermind. I figured out.

catalin.ciobanu
13 Oct 2011, 12:15 AM
well then share your solving .. maybe other ppl would be interested

r4nd7263
13 Oct 2011, 2:30 AM
well then share your solving .. maybe other ppl would be interested

:)) I shoulda studied the API a bit more before asking the question.

It was easy as



beanModel.setData("label", wrappedBean.getLabel());
beanModel.setDisplayField("label");


Had do this in a loop though. Would be nice if there is even simpler way.

catalin.ciobanu
13 Oct 2011, 2:33 AM
that wasn't a question. I was just asking you to post because there may be other people who may have the same problem as you; if they see your solving they won't post a new thread

r4nd7263
13 Oct 2011, 2:39 AM
that wasn't a question. I was just asking you to post because there may be other people who may have the same problem as you; if they see your solving they won't post a new thread

No I wasn't laughing at you asking me to post the solution. I was laughing at myself for I didn't realize how simple the solution was. So simple it didn't occur to me to post the solution at first. Thanks for reminding me.