PDA

View Full Version : ListField selection problem...



navandres
28 Dec 2011, 11:31 AM
Hi there. I've found some odd behavior and I think that it's a bug. I'm working with gxt-2.2.5-gwt22. I'm trying to select some BaseModel elements from a ListField, using setSelection method. The store is loaded and everything seems to be OK. When I invoke the setSelection method, I've got an error on ListViewSelectionModel.onLastFocusChanged method. The problem is that listStore attribute is not set, so I get an error in the following line:

i = listStore.indexOf(newFocused);

I wonder why, if I set the ListField with a storelist through the setStore, shoulden't that set the inner ListView object with this store?

I did that to save the problem. Is that a bug?

Cheers,
Andres

navandres
28 Dec 2011, 12:31 PM
java.lang.NullPointerException
at com.extjs.gxt.ui.client.widget.ListViewSelectionModel.onLastFocusChanged(ListViewSelectionModel.java:318)
at com.extjs.gxt.ui.client.widget.selection.AbstractStoreSelectionModel.setLastFocused(AbstractStoreSelectionModel.java:422)
at com.extjs.gxt.ui.client.widget.selection.AbstractStoreSelectionModel.doMultiSelect(AbstractStoreSelectionModel.java:304)
at com.extjs.gxt.ui.client.widget.selection.AbstractStoreSelectionModel.doSelect(AbstractStoreSelectionModel.java:322)
at com.extjs.gxt.ui.client.widget.selection.AbstractStoreSelectionModel.select(AbstractStoreSelectionModel.java:233)
at com.extjs.gxt.ui.client.widget.selection.AbstractStoreSelectionModel.setSelection(AbstractStoreSelectionModel.java:255)
at com.extjs.gxt.ui.client.widget.form.ListField.setSelection(ListField.java:200)



Hi there. I've found some odd behavior and I think that it's a bug. I'm working with gxt-2.2.5-gwt22. I'm trying to select some BaseModel elements from a ListField, using setSelection method. The store is loaded and everything seems to be OK. When I invoke the setSelection method, I've got an error on ListViewSelectionModel.onLastFocusChanged method. The problem is that listStore attribute is not set, so I get an error in the following line:

i = listStore.indexOf(newFocused);

I wonder why, if I set the ListField with a storelist through the setStore, shoulden't that set the inner ListView object with this store?

I did that to save the problem. Is that a bug?

Cheers,
Andres

sven
28 Dec 2011, 12:43 PM
Is it possible that you are using a selectionmodel that is not bound to the listview?

navandres
28 Dec 2011, 1:09 PM
mmmm, I think I don't. But may be you can take a look at the code. It's not complicated.

I can't attach a file. I don't understand why. Can I send you the file through skype?

Thanks for your time.

Cheers,
Andres

SurendarRaj
19 Mar 2012, 4:03 AM
Hi Andres,
Even i am facing the same problem.Any Solution for this............

Regards,
Surendar Raj

navandres
19 Mar 2012, 4:29 AM
Raj,
As far as I remember, it was a problem of timing. I was loading the ListStore through an RPC and I was trying to select from that store before that. The confusion there was that debuging, I got there and the error had no sence because the time that takes to get you on debug, the thread that loads the ListStore did it's work. What I did was to do the setSelection on the callback. It really depends on your code and the way it is placed, but basically I have to synchronize to separate threads.

Cheers,
Andres