on 02-04-2011 9:31 AM
Hi All
I am trying to setting colors to table rows based on dropdown value.
lv_Dropdown vaue =1 i want to set one color, 2-another color like that.
For this I create attribute CELL_DESIGN of type WDUI_TABLE_CELL_DESIGN in node, and i bind this attribute to every column celldesign property in table. and my code in on select of dropdown.
data lr_column type ref to cl_wd_table_column.
data:obj_table type ref to cl_wd_table.
lr_column = obj_table->get_column( id = 'TABLE_WEEK1' ).
if lv_dropdown = 1.
lr_column->set_cell_design(
cl_wd_table_column=>e_cell_design-badvalue_dark ).
endif.
lr_column->bind_cell_design( path = 'SEGMENT1.CELL_DESIGN' ). ...Giving dump at r_colum = get_column( )
I follow correct code or not??
Cheers,
Venkys.
You need to find the obj_table first
obj_table ?= view->get_element( '<TABLE ID>').
thanks
sarbjeet singh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sorry Sarbjeet and baskaran i am not getting,
I want to set colors to row of a table on dropdown selection. In dropdown i ahve a code like
DATA lo_nd_segment1 TYPE REF TO if_wd_context_node.
DATA lo_el_segment1 TYPE REF TO if_wd_context_element.
DATA ls_segment1 TYPE wd_this->Element_segment1.
data lt_segment1 type wd_this->elements_segment1.
DATA lv_segment TYPE wd_this->Element_segment1-segment.
navigate from <CONTEXT> to <SEGMENT1> via lead selection
lo_nd_segment1 = wd_context->get_child_node( name = wd_this->wdctx_segment1 ).
get element via lead selection
lo_el_segment1 = lo_nd_segment1->get_element( ).
lo_el_segment1 = WDEVENT->GET_CONTEXT_ELEMENT( 'CONTEXT_ELEMENT' ).
get all declared attributes
lo_el_segment1->get_static_attributes(
IMPORTING
static_attributes = ls_segment1 ).
DATA : lv_dropdown type string .
lv_dropdown = ls_segment1-segment.
if lv_dropdown = 1. SET ONE COLOR TO THAT ROW
endif.
if lv_dropdown = 2. SET ONE COLOR TO THAT ROW
endif.
Now what should be the code in WDMODIFYVIEW method to set table row with colors.
Cheers,
Venkys.
Hallo Venky,
Your first post suggested that you do dynamic programming. That is why we suggested to get the table refrence in domodifymethod so that you can use it later in your column iteration.
First of all please try to write it in a clear a way ,so that we all do not have to waste time !!!.
If you have binded your context attribute to the cell_editor property. You only have to work with context attribute to set the different color values (bad,red,dark..etc). So you do not need any code in domodifyview method.
So, your last post seems to me logic. On Select event of the drop down, set the attribute value to one or other.
Please post if you have any problem with this approach.Please also search on SCN '' Table coloring " , there are wikis and blogs on this specific subject.
if you have binded all the cells's design property to the attiribute cell_design present under segment1 node.
then just change its value in the if condition like as below.
data lv_segment type ref to if_wd_context_node.
lv_segment = wd_context->get_child_node( 'SEGMENT1' )
data desnval type WDUI_TABLE_CELL_DESIGN.
if lv_dropdown = 1.
desnval = cl_wd_table_column=>e_cell_design-badvalue_dark.
endif
if lv_dropdown = 2
desnval = cl_wd_table_column=><some other value>.
endif.
lv_Segment->set_Attribute(
name = 'CELL_DESIGN'
VALUE = desnval
).
thanks
sarbjeet singh
>
> Hi All
>
> I am trying to setting colors to table rows based on dropdown value.
> lv_Dropdown vaue =1 i want to set one color, 2-another color like that.
>
> For this I create attribute CELL_DESIGN of type WDUI_TABLE_CELL_DESIGN in node, and i bind this attribute to every column celldesign property in table. and my code in on select of dropdown.
>
> data lr_column type ref to cl_wd_table_column.
> data:obj_table type ref to cl_wd_table.
>
> lr_column = obj_table->get_column( id = 'TABLE_WEEK1' ).
> if lv_dropdown = 1.
> lr_column->set_cell_design(
> cl_wd_table_column=>e_cell_design-badvalue_dark ).
> endif.
> lr_column->bind_cell_design( path = 'SEGMENT1.CELL_DESIGN' ). ...Giving dump at r_colum = get_column( )
> I follow correct code or not??
>
>
> Cheers,
> Venkys.
Hi,
lr_column = obj_table->get_column( id = 'TABLE_WEEK1' ).
in this code i am not seeing the obj_table is assigned/created. That is why you get dump
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
101 | |
13 | |
13 | |
11 | |
11 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.