Code here: http://plnkr.co/edit/PfOgEDphwrnSXwatB6Yo?p=preview
I have a collection of products that I need to show on the screen. I load the JSON model and set it as a general model and I have an aggregation binding on a grid's content
var productTemplate = new sap.ui.view({
viewName: "view.Product",
type: sap.ui.core.mvc.ViewType.HTML
});
grid.bindAggregation("content", "/", productTemplate);
The productTemplate is a html view as you can see:
<div id="mySimpleTemplate" data-type="text/x-handlebars-template">
<h3>Product</h3>
<b>{{text path="name"}}</b>
</div>
<script>
sap.ui.template();
</script>
There are two issues:
The relative binding is not working. The name of the product is not displayed. If I use absolute binding {{text path="/3/name"}} the name will be displayed ok.
Second big issue is that the templating is only applied for the FIRST element. Afterwards the html view is interpreted as simple text
Where do I make the mistake? Also, the documentation on HTML template is quite limited on SAP official site. Can you provide some tutorials, examples links?
Thank you!