Reputation: 241
I develop a Split App. There is a List Item, if I click on an item, it will navigate to another view. But it can not navigate and give error
Uncaught Error: Cannot add text nodes as direct child of an aggregation. For adding text to an aggregation, a surrounding html tag is needed
The error points to this.getRouter().navTo(...) in the controller. Can someone tell me where I'm wrong? Thank you
This is the onSelect event to navigate
onSelect : function(oEvent) {
var oContext = oEvent.getSource().getBindingContext("Z5"));
var oTransferData = this.createTransferData(oContext);
if(this.transferData === undefined) {
this.transferData = new JSONModel();
}
this.transferData.setData(oTransferData);
sap.ui.getCore().setModel(
this.transferData,
"StockFrom"
);
this.getRouter().navTo(
"to",
{
CODE : oTransferData.CODE,
WERKS : oTransferData.WERKS
});}
I have target and route in manifest.json
"routes": [ {
"pattern": "StockFrom/Code={CODE}/Location/Site={WERKS}",
"name": "to",
"target": "stockTo"
},
"targets":
"stockTo": {
"viewName": "stockTo",
"viewLevel": 2
},
This is target view stockTo.view.xml
<mvc:View controllerName="Z5.controller.stockTo" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:core="sap.ui.core"
xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m">
<App>
<pages>
<Page>
<content>
<core:Fragment fragmentName="Z5.view.fragment.stockTo.content" type="XML"/>
</content>
<footer>
<core:Fragment fragmentName="Z5.view.fragment.stockTo.footer" type="XML"/>
</footer>
</Page>
</pages>
</App>
And 2 fragments of it
content.fragment.xml
<core:FragmentDefinition xmlns="sap.m" xmlns:core="sap.ui.core">
<Table
...
>
<headerToolbar>
...
</headerToolbar>
<columns>
<Column>
<Label text="Plant" />
</Column>
<Column>
<Label text="Stock Quantity}" />
</Column>
<Column hAlign="Right">
<Label text="D. Quantity}" />
</Column>
</columns>
</Table>
and footer.fragment.xml
<core:FragmentDefinition xmlns="sap.m" xmlns:core="sap.ui.core">
<Toolbar width="100%">
<HBox width="100%" alignItems="Start" justifyContent="End">
<Button
...
/>
</HBox>
</Toolbar>
Upvotes: 0
Views: 1019
Reputation: 241
I have checked the target view and found an uninvited guest (character), somehow my friend accidental placed it there. If Web IDE can give a warning in the first place.
Upvotes: 1