on 12-14-2009 9:50 AM
Hi Friends,
I want to display an image using context attribute.
I copied my image in src/mimes/components folder.
I created an attribute of type string and set it's value to my image.jpg file , which is there in above mentioned folder.
Still at runtime, my image is not displayed.
I tried changing the type to binary, but in that case, i don't know how to set a value to this attribute type.
Can you please tell me how to proceed on this?
If the image URL is fixed you can just set the "source" property of the Image UI element to the image filename. The image must be stored in folder src/mimes/component/<componentName>.
Armin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Armin,
Thanks for your reply.
I have saved my image in src/mimes/components/component_name folder as you mentioned.
I am using NW 7.0, hence there is no browse option for image source property.(which is available in 7.1).
Therefore, I have to display this image using value attribute. I am confused whether attribute type shoud be string or binary.
Which can be a better option ?
Also, I tried both the options, one after the other, but the image is not getting displayed.
Can you please tell me the exact steps involved in it?
Thanks Armin.
One more thing : We have assigned values to two properties, alt and source.
At source, we directly wrote the image name. alt is used to display something if the image is not displayed.
And at alt, we bound it to context attribute of type string and we are setting image name to this context attribute in init method.
Still it doesn't display any image. What mistake may we be doing?
Also, it i thought WD explorer will automatically show my component name under components, but it didn't. Hence we created one folder with our component name. We manually pasted image in that folder. But now, the folder appears, but it doesn't display the image under that folder.! . Something wrong, here itself?
Yes, there is. At first, your mimes folder will be empty. This means, you will have no "directories" inside it when you have a newly created Component.
You need to create a folder using NWDS (Navigator view, Right-Click mimes/Components, New -> Other -> Simple -> Folder) - I assume the full qualified Component name is required as the folder name.
Paste your image in that folder. From now on, if you "Refresh" the WD Explorer view the folder and image should be displayed there) - To use an Attribute, you can create any Attribute Name, type String, and remember to set the Cardinality of your Node correctly. You can use wdDoInit to set up the the image filename (as you did before). You need to bind the source property of your Image to this new Context Attribute just created. Or you can just "use" the image filename directly under the source property as Armin commented before (If this is some sort of Icon that might be used along several applications, consider having a DC to supply you the images, so this will avoid replication and consenquently, lower maintenance times).
Regards,
Daniel
That's not correct. The folder structure is created automatically by the NWDS. If you import an existing project, you sometimes have to use the "Repair -> Project Structure and Classpath" context menu entry to restore the folder structure.
If you ever find that the above is not true, please open an OSS message on BC-DWB-WD-JAV.
Armin
Amazing..
I've tried already like three or four NWDS versions, during all the upgrades, all of them bugged. I never opened OSS messages, I don't find worth it opening them. Seriously, I think I would have to open two OSS messages per week or more, too much time consuming.
But I guess it's always an option.. 😛
Daniel
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.