Let's follow up this discussion at the Neptune Community

(this forum will be kept in read-only mode)

TreeTable / sap.ui.table

I can not find any usable examples for this new object. Especially how do I select a row ????


reagards


Have you checked out the following example in Neptune Explored ?

https://template.neptune-software.com/neptune/sdk/explored.html#appEXP_SAMPLE_TREETABLE


You can always download it and import it into your system.



If you check UI5 reference, a way of selecting a specific row via javascript is

oTreeTable.setSelectedIndex(rowNumber);


More Info:

https://sapui5.netweaver.ondemand.com/sdk/docs/api/symbols/sap.ui.table.TreeTable.html


1 person likes this

Hi Andreas,


you started asking in a public forum topic, but every time you reply you are opening a new private support ticket.

If you agree, please let's follow in the forum topic so that it helps all other developers.  :)

(I will also paste this answer there).


I have to admit I had to guess a bit what you really needed since it was just a one line question:

"I can not find any usable examples for this new object. Especially how do I select a row ????"

 

to select a row you have two options:  use your mouse or do it via javascript.  oTreeTable.setSelectedIndex(rowNumber);

 

I think what you really wanted is "how to know in javascript what row the user has selected".

Cool. You found the answer, var value = oTreeTable.getSelectedIndex();

 

Now, regarding your last question: "why ist he TableTree greyed out for sending ?"

 

as Neptune does not use Nested structures,  the Treetable implementation is in fact a flat table on the ABAP side (IT_DATA) which has a "key" and a "parent" field.    Then, in runtime (JS) the Flat table is converted into a Nested Structure and set into the TreeTable object.

 

If you want to send some data back, then you have to use a new model.  Tipically it can be a sap.ui.table. 


So for example, if you want to send "the user-selected row to the backend", the way to do it is:   

1 - on the SelectionChange event of the TreeTable, you get the selected row and therefore you can get each field values (like matnr, date, etc).

2 - put those values in a new model  (can be a hidden sap.ui.table or a list). 

3 - in your ajax call, send the model which has been poputaled in step 2.


Kind regards,

Julian

Have you checked out Neptune Explored? Samples, Videos & Documentation www.neptune-software.com/explored

Finally, I have updated the oTreeTable.rowSelectionChange   event of the given example so that you can see how to get the values for each field of the selected row.

Hi Julian,
this really does not solve my Problem. As we already discussed in an earlier session - this App reads a lot of data and I just do not want to re-read the data. 1st Screen < 100 entries - no problem, 2nd screen 32000+ generates a condensed Tree Table no problem, selecting a row will read details out of the 32.000+ rows and displays a distinctive overwiew of details - this already does not work anymore because the Index I am retrieving looks at an empty table. I tried setting/ getting  cache with no result. The cache only works when I go back from the 2nd to the 1st. But maybe it is just me again :-(.

 

Andreas,


I am having a hard time understanding:


1 - what do you want to do.    (this post started as a question:  "how to select a row")

2 - what is the problem that stops you from doing it.


If you can send me a lot of screenshots (the more the better), I will be grateful.


Thanks !

 Hi Julian I hope this makes it more clear. I know that is not typical SAP Transaction Logic.

docx

Andreas, 


sorry but it is really difficult for me to understand.  (specially what oObject - popup is).


It seems the problem you have is that you want to send and receive data to the backend class.


For the "GUID" or whatever other field value you want to send,  just create a hidden page or a hidden panel object and bind it to an ABAP structure (workarea).


Then, send back and fort this workarea  to the ABAP class in every ajaxCall (so that you never loose its values).


Finally I do not recommend you to use a TreeTable for this scenario.    Just use a normal Table, populate it with the values you need and send it back and forth in the ajax calls.


Hi Julian I think I got. I will fire hidden events setting the global tables I need. I tried to do it with the 32000+ Table and it works. How do I hate Java Script, HTML5...... just kidding. Close the ticket I will do it and send it to you if you like.

 

I am going to cry. I implemented everything and now it seems that the getoline.... is executed erratic and not in the sequence i defined it.
var context = oEvent.oSource.getBindingContext();
var object = context.getProperty("OBJECT");
var method = context.getProperty("METHOD");
var parameter = context.getProperty("PARAMETER");
var clickedTile = context.getProperty("OBJECT");
sap.ui.core.BusyIndicator.show();
if (clickedTile !== lastTile) {
  getOnlineohiddenObjects(clickedTile);
  getOnlineohiddenTreeTable(clickedTile);
  getOnlineoTree(clickedTile);

  lastTile = clickedTile;
} else {
  oApp.to(oPageObjL);
  lastTile = clickedTile;
}

if (method === '') {
  eval(object);
} else {
  var obj = window[object];
  obj[method](parameter);
}

 

Hi Andreas, 


ajax calls (getOnline...) are asynchronous, meaning that the first one you trigger might not be the first backend call that is finished.

Why do you need three ajax calls anyway? Just create one call, trigger your ABAP logic sequentially in the backend, and receive all data models at once:



Hope this is helpful and not more confusing :)

Have a great weekend!


Christoph



A closing statement.
The Tree Table is just not usable for me (I found it out the hard way).
1) not responsive and not working on mobile phones
2) extremely slow response time (only 151 Records buffered !!!) no idea why
I exchanged it for table / table.m and it is blazing fast - all i changed was TableTree to Table everything else is absolutely same. I just miss the nice expand/collapse but everything else works super nice.

Thx support for all your help

 

Thanks for the update, Andreas.  I am glad to know you moved back to the table. :)

Looking forward to your training in the upcoming week.

Login or Signup to post a comment