Search code examples
javascriptxmlsapui5treetable

Failed to load 'sap/ui/table/TreeTable.js'


I'm trying to create a tree structure view from a json model using SAPUI5.
I haven't found solutions on the internet so this is why I'm asking here.
Basically, despite having used the right code over and over again, It fails to load the TreeTable.js file, I have tried using multiple codes but no luck.
I am loading the TreeTable on a Dialog. This is the code:

<core:FragmentDefinition 
xmlns="sap.ui.table"
xmlns:mvc="sap.ui.core.mvc"
xmlns:m="sap.m"
xmlns:u="sap.ui.unified"
xmlns:core="sap.ui.core">
<m:Dialog horizontalScrolling="true" showHeader="true" state="None" stretch="false" title="{Soluzione}" type="Standard" verticalScrolling="true" contentWidth="90%">
    <m:content>
        <TreeTable
        id="Tree"
        rows="{path: 'applicationModel>/AlberoSoluzioni'}"
        selectionMode="MultiToggle"
        enableSelectAll="false"
        ariaLabelledBy="title">
            
        </TreeTable>
    </m:content>
    <customHeader/>
    <endButton/>
    <subHeader/>
</m:Dialog>
</core:FragmentDefinition>

Wondering what I'm doing wrong. Error in console at loading:

Uncaught Error: failed to load 'sap/ui/table/TreeTable.js' from resources/sap/ui/table/TreeTable.js: 404 - Not Found

Solution

  • You need to add its dependencies in the manifest.json please check if you did so.

    "sap.ui5": {
            "dependencies": {
                "libs": {
                    "sap.ui.table": {}
                }
            }
    

    Also, check src in the bootstrap script in index.html