on 08-25-2006 11:39 AM
Hi
I want to show image in table based on the result i have a field status which contains the 01 / 02 / 03 values and now i want to show 3 images insted of value I have created one value attribute of string type and assigned the path of the image to it but its taking the image of last record only so can any one tell me what i have to do for this bellow is the code i am using
wdContext.currentContextElement().setImgXiStatus("");
if(xistatus.equals("01"))
{
wdContext.currentContextElement().setImgXiStatus("green.bmp");
}
else if(xistatus.equals("02"))
{
wdContext.currentContextElement().setImgXiStatus("yellow.bmp");
}
else if(xistatus.equals("03"))
{
wdContext.currentContextElement().setImgXiStatus("red.bmp");
}
else
{
wdContext.currentContextElement().setImgXiStatus("");
}
Thanks
Ninad
I would add a (read-only) <b>calculated </b> attribute "Icon" (string) under the table data source node.
If you cannot add attributes under this node (because it has a structure binding), you can add a helper value node (cardinality 1:1, selection 1:1, singleton=false) and add the "Icon" attribute there.
Implement the get-method like this:
String getIcon(I<Node>Element element)
{
if ("01".equals(element.getXiStatus())
{
return "green.bmp";
}
else if ("02".equals(element.getXiStatus())
{
return "yellow.bmp";
}
else if ("03".equals(element.getXiStatus())
{
return "red.bmp";
}
else
{
return "";
}
}
Armin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ninad,
Make the value attribute a part of the node that is the datsource of your table. If you create the value attribute as a part of your context root node, then all rows in the table will share the same value.
Regards,
Satyajit.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The problem is with your context structure..You are having only one element as you have created the attribute directly under root conext.
If the table datasource is bound to a model node then,create a helper node (value node cardinality-1:1, singleton-false)under the node that is bound to your table datasource and place your value attribute <i>ImgXiStatus </i>under the newly created helper node. Finally modify your code accordingly.
If the table datasource is bound to a value node, then simply put your value attribute <i>ImgXiStatus </i>under the value node.
Bala
Message was edited by: Bala Krishnan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Armin,
As a flow up to this Thread...
I want to show/hide an image base on data that is in attribute [structure binding attribute ...]
So... I took your suggestion and implemented it..
My question is:
How can I, from the "get-method" refer to this attribute?
example:
My context looks like this:
1 - NODE_MY_TRNAS
1.1---NODEoutput
1.1.1---NODEetData
1.1.1.1---NODEimageNodeHelper
1.1.1.1.1---icon
1.1.1.2---attribute1[how can i get to this atytribute in the code]
1.1.1.3---attribute2
1.1.1.4---attribute3
Hope i'm understood...
10x hadar
1 - NODE_MY_TRNAS
1.1---NODEoutput
1.1.1---NODEetData
1.1.1.1---NODEimageNodeHelper
1.1.1.1.1---icon
Set singleton = false for node "NODEimageNodeHelper" and selection(NODEimageNodeHelper) = 1:1.
Assuming card(NODEetData) =0:N, you can set the icon for row number i as follows:
INODEetDataElement e = wdContext.nodeNODEetData().getNODEetDataElementAt(i);
e.nodeNODEimageNodeHelper().currentNODEimageNodeHelperElement().setIcon("icon.gif");
For naming nodes, the following rule is useful: Name in camel-case, first letter uppercase, for cardinality =0:N, use plural name.
Example:
Node "Books" (node, card=0:N) leads to IBooksNode, IBooksElement interfaces.
Armin
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.