on 10-21-2005 10:14 AM
Hello everybody,
I am trying to set in a table column different buttons (attribute image-source).
The buttons text-attribute is linked to the context. I would like to set the image-souce attribute dynamicly?
How can I do that? How should the be?
Thanks a lot,
Regards Mario
Hi Mario,
As AnilKumar has pointed out, create a string attribute inside the node that you have bound to the table. Let the attribute's name be 'image_src' and let the node bound to the table be 'table_node'.
After creating the Button UI element in the table column, bind it's 'imageSource' property to this attribute.
Now in your code,when you create the elements of the table set the 'image_src' value accordingly (depending on the condition you want). Here I'm giving you an example where alternate rows have the same icon.
IPrivate<View_name>.I<node_name>Element elmt;
for(int i=0;i<n;i++)
{
elmt = wdContext.create<node_name>Element();
elmt.set<parameter>(<value>);
if((i%2)==0)
elmt.setButt_image("~sapicons/s_b_okye.gif");
else
elmt.setButt_image("~sapicons/s_b_okno.gif");
wdContext.node<node_name>().addElement(elmt);
}
This example make use of the default sap icons available in the server. If you need your own images on the button, you can store them in src->mimes->components-> <your component>.
Hope this helps,
Best Regards,
Nibu.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Nibu,
thanks for your help. Unfortunately some things do not work:
a) elmt.set<parameter>(<value>);
--> What do you mean with <value> ? Which value should be there?
b) elmt.setButt_image("~sapicons/s_b_okye.gif");
--> I get an syntax error. setButt_image seems to be no method of elmt
Thanks and best regards, Mario
Hi Mario,
a) elmt.set<parameter>(<value>);
I was just giving you an example. If you have any other attribute in that node to set value for, you can set it there using the given syntax.
b) elmt.setButt_image("~sapicons/s_b_okye.gif");
I'm very sorry, the statement should have been
elmt.setImage_src("~sapicons/s_b_okye.gif"); // atleast in this example
where 'image_src' should be replaced by the attribute you created. In the given example, i just used the attribute's name as 'image_src'.
Best Regards,
Nibu.
You can create a valueAttribute and bid that to the Imagesource property in the way how you are doing for
text-attribute .
Regards, Anilkumar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
How should the be?
--> How should the coding be?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
24 | |
11 | |
9 | |
7 | |
6 | |
5 | |
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.