cancel
Showing results for 
Search instead for 
Did you mean: 

Custom Controls and layoutData

MattHarding
Active Contributor
0 Kudos

Hi all,

I've been looking at a bit of core UI5 code to diagnose how the following works, but maybe someone can provide a better answer without debugging thousands of lines of debug ui5 code for me...

Consider the scenario where I have a splitter, and I want to set some layout specific information against an object (fixed left column in this example).

e.g.


            <l:Splitter>

                <Panel headerText="panel">

                    <layoutData><l:SplitterLayoutData size="300px" resizable="false"/></layoutData>               

                    <Text text="hello"/><Text text="hello"/><Text text="hello"/>

                </Panel>

                <Panel headerText="test">

                    <layoutData><l:SplitterLayoutData size="auto" /></layoutData>                       

                    <Text text="hello"/><Text text="hello"/><Text text="hello"/>

                </Panel>

            </l:Splitter>

This works fine...Now for my example, I copied Panel (and the PanelRenderer into my own namespace, removed the library references from the sap.ui.define and the library tag next to properties (which may be the issue) and replaced that new control in my project.


            <l:Splitter>

                <v:Test headerText="panel">

             

                    <Text text="hello"/><Text text="hello"/><Text text="hello"/>

                </v:Test>

                <Panel headerText="test">

                    <layoutData><l:SplitterLayoutData size="auto" /></layoutData>                       

                    <Text text="hello"/><Text text="hello"/><Text text="hello"/>

                </Panel>

            </l:Splitter>

The above displays fine, but when I go to add the "<layoutData><l:SplitterLayoutData size="300px" resizable="false"/></layoutData>" line at line 3 above, I get the following error:

>failed to load 'sap/m/layoutData.js' from resources/sap/m/layoutData.js

e.g. It is treating it as a new object and not an aggregation that mysteriously is available for SAP controls.  I looked into Splitter and how it could work, but I'm still missing something.

Any Ideas?

Cheers,

Matt

Accepted Solutions (1)

Accepted Solutions (1)

MattHarding
Active Contributor

Thanks to Graham Robinson (who replied via Twitter), it was simply a missing namespace in this scenario. e.g. <v:layoutData><l:SplitterLayoutData size="300px" resizable="false"/></v:layoutData>

Originally I had this, but for my own custom control this didn't work; but I can start stripping away Panel now to see how it works!

Thanks Graham!

Answers (0)