Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

470
Vistas
TypeError: this.byId(...).close is not a function

the code is from [SAP UI5 walkthrought][1] and code with brandon on youtube. I am getting this error .close is not a function. I tried different ways and couldn't find a solution.

Next.controller.js

sap.ui.define([
"sap/ui/core/mvc/Controller",
"sap/m/MessageToast",
"sap/ui/core/Fragment"], function (Controller, MessageToast, Fragment) {
"use strict";

return Controller.extend("sap.ui.demo.walkthrough.controller.HelloPanel", {

    onShowHello : function () {
        // read msg from i18n model
        var oBundle = this.getView().getModel("i18n").getResourceBundle();
        var sRecipient = this.getView().getModel().getProperty("/recipient/name");
        var sMsg = oBundle.getText("helloMsg", [sRecipient]);

        // show message
        MessageToast.show(sMsg);
    },

    onOpenDialog : function () {

        if (!this.pDialog) {
            this.pDialog = this.loadFragment({
                name: "sap.ui.demo.walkthrough.view.HelloDialog"
            });
        } 
        this.pDialog.then(function(oDialog) {
            oDialog.open();
        });
    },

    onCloseDialog : function () {
        // note: We don't need to chain to the pDialog promise, since this event-handler
        // is only called from within the loaded dialog itself.
        this.byId("HelloDialog").close();
    }
});});

HelloDialog.fragment.xml

<core:FragmentDefinition
 xmlns="sap.m"
 xmlns:core="sap.ui.core">
<Dialog
    id="helloDialog"
    title="hello {/recipient/name}">
    <beginButton>
        <Button
           text="{i18n>dialogclose}"
           press=".onCloseDialog"/>
    </beginButton>
</Dialog></core:FragmentDefinition>

At last I just copied the same code yet getting the same error ".close is not a funtion" [1]: https://sapui5.hana.ondemand.com/#/topic/4da72985139b4b83b5f1c1e0c0d2ed5a

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

In the close method you have written this.byId("HelloDialog").close(); but the id of the dialog is helloDialog.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda