(Using most recent version of SmartGWT)
I am creating a TileGrid to display images + textin SmartGWT; this is up and running.
To set the image I am doing:
node.setAttribute("picture", "http://servername/images/3334445000.jpg");
With this, the url will change based on a number associated with each 'node' (unique identifier). The desired functionality is to have the "picture" attribute set to a default image if the specific image doesn't exist.
For example:
if( "http://servername/images/3334445000.jpg" [exists] )
node.setAttr开发者_如何转开发ibute("picture", "http://servername/images/3334445000.jpg");
else
node.setAttribute("picture", "http://servername/images/default.jpg");
The [exists] portion being what I am having troubles with. I'm sure there is an easy way to make this happen, but I'm new to SmartGWT and still learning. Again, everything else is working, no errors; just need guidance on the default image.
精彩评论