Quantcast
Channel: SCN : All Content - SAPUI5 Developer Center
Viewing all articles
Browse latest Browse all 6178

Use Template on non-visual aggregation for inserting into existing bound sap.m.Table

$
0
0

For reference, this question first appeared on StackOverflow (though unfortunately unanswered to date hence why included here):

stackoverflow.com/questions/27291047/use-template-on-invisible-table-for-inserting-into-existing-bound-sap-m-table

 

I have a requirement to display a list of "spare parts" in an sap.m.Table but there is the ability if one of these "spare parts" has a related "spare part" (e.g. A heavy duty version, a light version, etc) , that you can click a button on the row and display these related "spare parts" by inserting them immediately below the "spare part" in question.

While I can get the sap.m.Table doing what I want to do using the insertItems method, I would like to take advantage of templates and binding to create a temporary sap.m.Table; bind it to the relationship that returns these alternate spare parts; and reuse the template for a row to give me an array of ColumnListItems which I can insert into the Table at the right place.

Unfortunately, doing this, a sap.m.Table has a feature that if it is not displayed, it doesn't actually make the Odata call and leverage the template function.

To explain possibly much clearer, refer to this jsbin: http://jsbin.com/sihofu/4/edit?html,js,output

Any better ideas on how to generate template output for a binding without using a sap.m.Table? (My next step is to look at UI5 code to see how function templates work with aggregations which may give me the answer)

The specific code to look at in the jsbin example is as follows:

var oTable2 = new sap.m.Table();

oTable2.attachUpdateFinished(

     function() {

          console.log("But this one doesn't");

          // What I'm trying to do here is insert these entries below Key 1

     });

oTable2.bindAggregation("items", { path: "/ExampleSecondaryValues", template: oTemplate, });

Thanks, Matt


Viewing all articles
Browse latest Browse all 6178

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>