Skip to Content
0

SAP UI TreeTable Control overwrite data problem

Jun 18, 2017 at 09:47 AM

59

avatar image

Hi all,

Hi have successfully build an app with oData binding for TreeTable Control.

I've followed the steps of this tutorial : https://blogs.sap.com/2015/10/23/treetable-odata-binding/

Now my application seems to be good, but I realized that the hierarchy in the tree is incorrect.

I have three nodes :

>1

>2

>3

When i open for example the first node I'am getting the following results :

v 1

>2

>3

>1.3

>1.4

>1.5

>2

>3

I should have the following results:

v 1

>1.1

>1.2

>1.3

>1.4

>1.5

>2

>3

I check how my data is loaded in the method get_entityset, everything is fine in debugg.

The weird part is when I open the last node in the tree I get correct results...

Anyone has an idea?

Thanks in advance.

10 |10000 characters needed characters left characters exceeded

HI Sam

Can you share more information about the data in your model so that we can assist you?

Thanks

Dennis

0

Hi Dennis,

I've used the previous blog link (here) in order to bind my TreeTable control to my OData.

My model is created using the navigation properties ways.

In my model I have implemented the method NODES_GET_ENTITYSET in DPC_EXT class as follow:

METHOD nodeset_get_entityset.
    DATA: ls_entity LIKE LINE OF et_entityset,
          ls_key    LIKE LINE OF it_key_tab.
    CLEAR es_response_context–inlinecount.
* no navigation path – top level call
    IF lines( it_navigation_path ) = 0.
      DO 3 TIMES.
        ls_entity–id = sy–index.
        CONDENSE ls_entity–id.
        ls_entity–name = |Node { ls_entity–id }|.
        APPEND ls_entity TO et_entityset.
      ENDDO.
      es_response_context–inlinecount = lines( et_entityset ).
      RETURN.
    ENDIF.
    READ TABLE it_key_tab INTO ls_key INDEX 1.
    IF strlen( ls_key–value ) > 5. “stop here
      RETURN.
    ENDIF.
* this is a call using navigation from parent
* Read key of parent node and return child nodes
    IF lines( it_navigation_path ) > 0.
      DO 5 TIMES.
        ls_entity–parentid = ls_key–value.
        ls_entity–id = |{ ls_entity–parentid }.{ sy–index }|.
        CONDENSE ls_entity–id.
        ls_entity–name = |Node { ls_entity–id }|.
        APPEND ls_entity TO et_entityset.
      ENDDO.
      es_response_context–inlinecount = lines( et_entityset ).
      RETURN.
    ENDIF.
  ENDMETHOD.

In my SAPUI5 Application I have created the Tree Table control with XML view.

My Control is binded to OData via rows attribute :

rows="{path: 'Nodes' , parameters: {expand: 'ChildNodes', navigation: {'Nodes' : 'ChildNodes' }}}"

All seems to work perfectly but in display, when I open a node its overwrite the others nodes.

Again the data is fetched correctly in the method NODES_GET_ENTITYSET.

v 1
>2
>3
>1.3
>1.4
>1.5
>2
>3

I should have the following results:

v 1
>1.1
>1.2
>1.3
>1.4
>1.5
>2
>3
0
* Please Login or Register to Answer, Follow or Comment.

0 Answers