At the beginning it was not clear for me that this is a mgwt - topic. But
you are right.
Adding a DomHandler which is listening on Error Events does not work. The
Window.alert-Message will be never reached.
cellList.addDomHandler(new ErrorHandler() {
@Override
public void onError(ErrorEvent event) {
Window.alert("error occurred!");
}
}, ErrorEvent.getType());
Inspired by http://www.stillnetstudios.com/onerror-img-image-tag/ I found
an other way. If I add in my uibinder.ui.xml:
<img class="{style.image}" src="{itemImage}" alt="" onerror="this.src=
'http://alternative/image.jpg'" />
It works but it seems not very elegant. E.g.: loop if onerror-image not
available/reachable. It would be nice to handle the onerror in gwt-code and
not in the declaration of the template. The next thing I need to test with
this solution is to display an Image-Resource from ClientBundle.
Am Mittwoch, 7. Januar 2015 18:27:32 UTC+1 schrieb Jens:
>
> A bit unfortunate that GWT has a CellList and MGWT has a CellList and both
> are totally different. Maybe you should ask this on a MGWT mailing list?
>
> But given that MGWT CellList is a Widget you can add any event handler to
> it using addDomHandler(). I am not sure about the error event but I would
> try adding a ErrorEvent/ErrorHandler to the CellList. If it really triggers
> then you should be able to figure out the <img> element and change its src
> attribute if loading has failed.
>
> And yes you need an <img> element because no event exists that tells you
> if a CSS background image has been loaded or not.
>
> -- J.
>
>
>
--
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.