cancel
Showing results for 
Search instead for 
Did you mean: 

Regarding the input field color

Former Member
0 Kudos

Hi ,

My requirement is that i need to fill the input field with some different color instead of plain color eg: yellow or gree or so ......

please suggest any solutions on this.

Regards,

Sana.

Accepted Solutions (1)

Accepted Solutions (1)

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

There is no direct property on the inputField that would allow you to set the color. As kk is suggesting, you can only really do this within a table (because you are actually setting the color of the surrounding cell and not the inputField itself).

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Thomas,

Thanks for the solution i was wondering that we cannot set colors to input fields.

Thanks,

Sana.

former_member342104
Participant
0 Kudos

method wddomodifyview .

data: obj_table type ref to cl_wd_table,

lr_column type ref to cl_wd_table_column,

lr_column1 type ref to cl_wd_table_column,

lr_input type ref to cl_wd_input_field,

lr_input1 type ref to cl_wd_input_field.

data:

node_flights type ref to if_wd_context_node,

ls_flights type if_main=>element_flights,

ls_flights1 type sflight,

it_flights type if_main=>elements_flights,

it_final type if_main=>elements_flights,

lr_header type ref to cl_wd_caption.

  • navigate from <CONTEXT> to <FLIGHTS> via lead selection

node_flights = wd_context->get_child_node( name = 'FLIGHTS' ).

select * from sflight

into corresponding fields of table it_flights up to 100 rows.

obj_table ?= view->get_element( 'TABLE1' ).

obj_table->set_visible_row_count( value = 50 ).

lr_column = obj_table->get_column(

id = 'TABLE1_PRICE'

).

lr_header = lr_column->get_header( ).

lr_header->set_text( value = 'Money' ).

lr_column->set_header( the_header = lr_header ).

lr_column1 = obj_table->get_column(

id = 'TABLE1_CARRID'

).

lr_input = cl_wd_input_field=>new_input_field(

bind_value = 'FLIGHTS.PRICE'

id = 'IP1'

).

lr_input->set_read_only( value = abap_false ).

lr_input1 = cl_wd_input_field=>new_input_field(

bind_value = 'FLIGHTS.CARRID'

id = 'IP2'

).

lr_input1->set_read_only( value = abap_false ).

loop at it_flights into ls_flights .

if ls_flights-price = '185.00'.

ls_flights-readonly = abap_true.

ls_flights-cell_design =

cl_wd_table_column=>e_cell_design-badvalue_dark.

else.

ls_flights-cell_design =

cl_wd_table_column=>e_cell_design-goodvalue_medium.

endif.

append ls_flights to it_final.

endloop.

lr_column->bind_cell_design( path = 'FLIGHTS.CELL_DESIGN' ).

lr_input->bind_read_only( path = 'FLIGHTS.READONLY' ).

lr_column->set_table_cell_editor( the_table_cell_editor = lr_input ).

lr_column1->set_table_cell_editor( the_table_cell_editor = lr_input1 ).

node_flights->bind_table(

new_items = it_final

).

endmethod.

regards

kk

Edited by: kk on Oct 27, 2008 1:05 PM

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

It should be noted that kk's example is far more complicated than necessary doing such dynamic coding in the WDDOMODIFYVIEW is unnecessary, dangerous and should only be reserved when absolutely necessary for dynamic UI layouts and generated UIs. That is not the case in this case.

What you should do is simply bind a context attribute column's cellDesign property and then fill that context attribute in one of your controller or view methods. There is no reason to set the binding dynamically or most all of the other processing going on in this example.