Coder Social home page Coder Social logo

Comments (3)

stopcoder avatar stopcoder commented on September 16, 2024 1

Hi @boghyon,

with the last paragraph in Require Modules in XML View and Fragment, we want to point out that the core:require on FragmentDefinition doesn't work when the view where the fragment is used is preprocessed. The preprocess here means that either preprocessor is registered to XMLView or the preprocessors option is set when creating a XMLView instance, details can be seen here. The Fragment is not defined inline in the XMLView but in a separate location.

What you found here is another case where the core:require doesn't take any effect when writing the FragmentDefinition inline within a View definition. This isn't mentioned in the documentation and should be added there.

In both of the cases where the core:require doesn't have any effect, the FragmentDefinition node isn't included in the created XMLView instance. Therefore the core:require attribute in the FragmentDefinition isn't available for its child nodes.

I will rewrite the paragraph regarding core:require in Fragment and explicitly state that the core:require doesn't work on FragmentDefinition node when:

  • The View where a fragment is used is preprocessed
  • A fragment is defined inline in a View

Best regards,
Jiawei

from openui5-docs.

boghyon avatar boghyon commented on September 16, 2024

Now I get it.

This works:

src: https://jsbin.com/luzekib/edit?js,output

<core:FragmentDefinition xmlns:core="sap.ui.core"
  core:require="{
    IntegerType: 'sap/ui/model/type/Integer'
  }">
  <!-- ... -->
</core:FragmentDefinition>

Whereas..

This doesn't:

src: https://jsbin.com/baxetik/edit?js,output

<mvc:View xmlns:mvc="sap.ui.core.mvc">
  <core:FragmentDefinition xmlns:core="sap.ui.core"
    core:require="{
      IntegerType: 'sap/ui/model/type/Integer'
    }">
    <!-- ... -->
  </core:FragmentDefinition>
</mvc:View>

TBH, the mentioned paragraph is a bit confusing since it begins saying that core:require works on the FragmentDefinition node, and the next sentences deny it right away.

from openui5-docs.

SabineLoss avatar SabineLoss commented on September 16, 2024

In progress - waiting for feedback from dev

from openui5-docs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.