cancel
Showing results for 
Search instead for 
Did you mean: 

How to auto expand a node while drag and drop?

Former Member
0 Kudos

Hi all,

With drag and drop a user can select UI elements from a UI area (source), drag them from the source, and drop them into another UI element area,While we drop an element it should get expand(that node).How to auto expand?

Thanks,

Kiran

Accepted Solutions (0)

Answers (1)

Answers (1)

saravanan_narayanan
Active Contributor
0 Kudos

Hello Kiran,

it depends on the target ui element. If your target UI element is Hierachical table, then in the ondrop event, you can set the Expanded property value to abap_true ( via context attribute binding)

BR, Saravanan

Former Member
0 Kudos

Hi Sarvana,

Thanks for the response.

Here is my code:

ls_table_data_source-is_leaf = abap_true.

ls_table_data_source-expanded = abap_true.

Still not getting expanded.Please let me if i am doing something wrong.

Thanks,

Kiran

saravanan_narayanan
Active Contributor
0 Kudos

Hello Kiran,

why are you setting a the is_leaf = abap_true? if the node is leaf then it means that there no child elements. So you can't expand that node. So in your case if the node is having child elements then you need to set is_Leaf to abap_false and is_expanded to abap_true for that context element node.

BR, Saravanan

Former Member
0 Kudos

Hi Saravanan,

I tried this also but still same problem.Any other option?

saravanan_narayanan
Active Contributor
0 Kudos

this should work. if its not working then post your code. Hope after setting the value your updating the context element.

Br, Saravanan

Former Member
0 Kudos

Here is the test code:

lo_nd_table_data_source = wd_context->get_child_node( name = wd_this->wdctx_table_data_source ).

lo_nd_table_data_source->get_static_attributes_table( IMPORTING table = lt_table_data_source ).

"Read Dummy Table

lo_nd_table_data_source->get_static_attributes_table( IMPORTING table = it_table_data_source ).

CONCATENATE ls_airline_info-carrid ls_airline_info-connid ls_airline_info-fldate INTO ls_table_data_source-row_key.

ls_table_data_source-parent_row_key = ls_airline_info-carrid.

ls_table_data_source-is_leaf = abap_false.

ls_table_data_source-expanded = abap_true.

SELECT * FROM sflight INTO CORRESPONDING FIELDS OF TABLE it_table_data_source.

LOOP AT it_table_data_source INTO wa_table_data_source WHERE carrid = ls_airline_info-carrid

and connid = ls_airline_info-connid

and fldate = ls_airline_info-fldate.

ls_table_data_source-connid = ls_airline_info-connid.

ls_table_data_source-fldate = ls_airline_info-fldate.

ls_table_data_source-PRICE = wa_table_data_source-PRICE.

ls_table_data_source-CURRENCY = wa_table_data_source-CURRENCY.

.

"Select all data to the new dummy table structure.

"Move one row of the table to ls_table_data_cource correspondingle.

APPEND ls_table_data_source TO lt_table_data_source.

DELETE ADJACENT DUPLICATES FROM lt_table_data_source.

ENDLOOP.

lo_nd_table_data_source->invalidate( ). "Clear the table data

lo_nd_table_data_source->bind_table( lt_table_data_source ). "Refresh new data

Thanks,

Kiran

saravanan_narayanan
Active Contributor
0 Kudos

Hello Kiran,

I think delete adjacent will delete the newly inserted row because the order of the newly inserted row is after the actual row.

before appending the ls_table_data_source to lt_table_data_source better delete the already existing record from lt_table_data_source.

or you can go with field symbols and irectly change the value. in this case append is not required


field-symbols: <wa_table_data_source> like line of it_table_data_source.

loop at it_table_source assigning <wa_table_data_source> where...

<wa_table_data_source>-is_leaf = abap_false
<wa_table_data_source>-is_expanded = abap_true.

endloop.

Br, Saravanan