W dniu sobota, 16 lutego 2013 23:26:19 UTC+1 użytkownik membersound napisał:
>
> Hi,
>
> I add a new entry to a DataTable and want to scroll it into the view, as 
> it is added at the end of the list.
>
> @UiHandler("buttonAdd") {
> onAdd(ClickEvent evt) {
>   Foo foo = new Foo();
>   dataProvider.getList().add(foo);
>   
> dataGrid.getRowElement(dataProvider.getList().indexOf(foo)).scrollIntoView();
> }
>
> But when I add the items I get following errors.
>
> Adding 1st item:
> com.google.gwt.event.shared.UmbrellaException: Exception caught: Row 
> index: 0, Row size: 0
>
> Adding 2nd item:
> com.google.gwt.event.shared.UmbrellaException: Exception caught: Row 
> index: 1, Row size: 1
>
> WHY??
>
>
>
My guess.

After dataProvider.getList().add(foo) is executed,
DataDrid is updated asynchronously, 
and you try to 
dataGrid.getRowElement(...) 
before this update happens.

Maybe
Scheduler.get().scheduleDeferred(...)
will help you.



 

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to