on 05-26-2009 12:49 PM
hi all,
I am displaying a table in webdynpro.Based on the condition the rows of the table should be in different color.
Hi Siva,
Suppose I am displaying the data from SFLIGHT in a table & I want all the rows with PRICE > 500 in one colour and the rest in another then you can proceed as follows:
I have a context node by name SFLIGHT & it has CARRID, CONNID, FLDATE & PRICE as its attributes. In addition to these 4 dictionary fields I have a 5th attribute under the same node by name COLOUR. This is of type: WDUI_TABLE_CELL_DESIGN. I would be using this for changing the table's row colour. I dont hev any special settings for my context node.
SFLIGHT node:
Cardinality: 0..n
Selection: 0..1
I design a table in my layout & am displaying only the 4 dictionary fields in the table. (i.e, while doing the binding for the table I uncheck the checkbox for COLOUR so that it wouldnt get displayed.) Now I go to each column and bind its "cellDesign" property with the context attribute COLOUR. (i.e, MAIN.SFLIGHT.COLOUR)
So now as how you would have understood while populating my table with values I would just have to fill the context attribute COLOUR with the right value to reach the desired solution.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
So thats it! Now upon execution your table would show all rows which have PRICE > 500 in 1 colour & the rest in another.
If you would like to check the possible list of values which you can assign then you can check the value range of the domain WDUI_TABLE_CELL_DESIGN which is associated with the type of the same name. (i.e, WDUI_TABLE_CELL_DESIGN).
Regards,
Uday
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Below is the coding from WDDOINIT that I use for populating the table & attribute COLOUR with data.
method WDDOINIT .
data: wd_node type ref to if_wd_context_node,
lt_sflight type wd_this->elements_sflight,
wa_sflight type wd_this->element_sflight.
wd_node = wd_context->get_child_node( name = 'SFLIGHT' ).
*** Fetch the desired data from SFLIGHT
select carrid
connid
fldate
price from sflight into corresponding fields of table lt_sflight.
*** Am just trying to reduce the resultset so that it would be easier to see the output
sort lt_sflight by price.
delete adjacent duplicates from lt_sflight comparing price.
*** This is the main part. I loop through the data from SFLIGHT & check which rows have PRICE > 500
*** I assign different values to the COLOUR attribute when it is ( greater than 500 ) & ( less than or equal to 500 )
loop at lt_sflight into wa_sflight.
if wa_sflight-price > 500.
wa_sflight-colour = '11'.
else.
wa_sflight-colour = '07'.
endif.
modify lt_sflight from wa_sflight transporting colour.
endloop.
wd_node->bind_table( new_items = lt_sflight ).
endmethod.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.