cancel
Showing results for 
Search instead for 
Did you mean: 

table problem

Former Member
0 Kudos

hi,

I have a requirement where i have 2 columns in a table .. one should be read only and the other should be edittable... so i have inserted two cell editors of input field type..and made one as read only and the other one not read only.

but wen i run the application..both are displayed as readonly...

please help.

Regards,

Anurupa.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Anurupa,

The node which you are binding with table UI may not have any element thats why you are getting blank/disabled table. Try adding a element (may be blank) to this node and then run the application. You should see the desired result now.

If you need the code for adding element in a node, let me know.

Hope it helps.

Regards,

Amit

Former Member
0 Kudos

hi amit,

how do i add element to node..pls provide the code.. my table ui is enabled and visible..

Thanks

Anurupa

abhimanyu_lagishetti7
Active Contributor
0 Kudos

If you don't have any data to display then it will be disabled.

here is the code to add one record to the table.

data: lr_node type ref to if_wd_context_node.

data: ls_stru type <node type >

lr_node = wd_context->get_child_node( '<childnodename>' ).

lr_node->bind_element( new_item = ls_stru ).

Abhi

Former Member
0 Kudos

Hi Anurupa,

For testing, you can write this code in your WDDOINIT method. But for real time scenario, I assume user is allowed to enter data in this table so you can create a button something like 'Add Row'. and then write following line of code in action of 'Add Row' Button. Please note that 'node_name' is the name of the node u would have actually bind your table with.

////////////////

DATA:

node_tab TYPE REF TO if_wd_context_node,

elem_tab TYPE REF TO if_wd_context_element.

node_tab = wd_context->get_child_node( <node_name> ).

elem_tab = node_tab->create_element( ).

node_Tab->bind_element( new_item = elem_tab SET_INITIAL_ELEMENTS = abap_false ).

//////////////

Hope it helps.

Regards,

Amit

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Anurupa,

At First the Table will not have any values.So the Table will display as Blank only.

So what you have to do is, you have to add blank rows to that table and Bind it.Then only it will consider that the Table is having Values and then the editable field will be visible.

Try this Codings,

DATA lo_nd_table TYPE REF TO if_wd_context_node.
  DATA lo_el_table TYPE REF TO if_wd_context_element.
  DATA lt_table TYPE wd_this->elements_table.
  DATA ls_table TYPE wd_this->element_table.

  lo_nd_table = wd_context->get_child_node( name = wd_this->wdctx_table ).

 do 5 times.
 clear ls_table.
append ls_table to lt_table.
enddo.

 lo_nd_table->bind_table( lt_table ).

Regards,

Padmam.

Former Member
0 Kudos

hi,

thanks a lot ... problem solved..

but i have another problem.

i have a dropdown of month in my first view... but wen i come back from my2nd view back to 1st view .. i want that the month dropdown should display blank..but it is showing the previous selected value (say : MAY) but i want it to display blank.

can u tell me how to do it??

thanks & regards

Anurupa

Former Member
0 Kudos

Hi

If the context attribute which you binded to the dropdown is in the componentcontroller's context then copy and map that attribute to the 2ndview context also and in the 'onback' action of the 2ndview get that attribute and clear

Hope this helps U

Regards

Tamil

abhimanyu_lagishetti7
Active Contributor
0 Kudos

Web Dynpro is a Stateful Application, so the data do not get vanished if you navigate to another view and come back.

This you have to achieve through coding, while navigating back to the first view, in the first view there is Inbound plug and a method is generated for the inbound plug.

You can write code to make the value to blank in the Inbound plug method

Abhi

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

>Web Dynpro is a Stateful Application, so the data do not get vanished if you navigate to another view and come back.

Actually this is not entirely accurate. Web Dynpro is of course Stateful and by default Views lifetimes continue even after they are no longer visible. However there is a setting on the View Property Tab where you can control this.

http://www.flickr.com/photos/tjung/2719810448/

If you set the Lifetime to "when visible" all local context nodes and attributes of the view will be released as soon as the view is no longer visible. Keep in mind that if your context nodes are bound from and external controller, this data will still be retained.

Former Member
0 Kudos

Hi

Populate the values in your table and check, i think it will work

Regards

Tamil

abhimanyu_lagishetti7
Active Contributor
0 Kudos

Check your root container is enabled or disabled first?

then your table's enable and read only property ?

Abhi