Skip to Content

Does not load Model in sap.m.Dialog RunTime (UI5 + Web Ide)

I'm starting in UI5, and I'm creating a master / detail until I can use the Model in the .view for components of type sap.m.Combobox, but I'm trying to create a sap.m.Dialog at runtime and add a sap.m .Combobox but he does not model it.

I'm trying in various ways and I can not list the values inside the sap.m.Combobox


], function(Controller) {
	"use strict";

	return Controller.extend("com.test.controller.Detail", {
		onInit: function (){
			var oRouter = sap.ui.core.UIComponent.getRouterFor(this);
			oRouter.getRoute("detail").attachMatched(this.onRouterMatched, this);
		onRouterMatched: function (event) {
			var oArgs;
			var oView;
			oArgs = event.getParameters("arguments");
			oView = this.getView();
				path: "/Loja('" + oArgs.arguments.LOJA_COD + "')"
		onAddVenda: function(event){ + " Pressed");

			var bundle = this.getView().getModel("i18n").getResourceBundle();

			var cancelButton = new sap.m.Button({
				text: bundle.getText("cancel_btn_text"),
				press: function(){
			var addButton = new sap.m.Button({
				text: bundle.getText("add_btn_text"),
				press: function(){
			var afterDialogClose = function(oEvent) {
			var listItem = new sap.ui.core.ListItem({
				key: "{LOJA_COD}",
				text: "{LOJA_DSC}"	
			var listItem2 = new sap.ui.core.Item({
				key: "{LOJA_COD}",
				text: "{LOJA_DSC}"	
			var comboTeste = new sap.m.ComboBox({
					width: '300px', items: {
						path: "/Loja",
						template: listItem2
			comboTeste.bindElement({path: "/Loja"});
			var simpleForm = new sap.ui.layout.form.SimpleForm({
				editable: true,
				content: [
					new sap.m.Label({text: "Data"}),
					new sap.m.DatePicker({width: "200px", valueFormat: "dd/MM/yyyy", displayFormat: "dd/MM/yyyy"}),
					new sap.m.Label({text: "{LOJA_COD}"}),
					new sap.m.Label({text: "Produto"}),
					new sap.m.ComboBox({width: "300px", items: {
						path: "/Produto",
						template: listItem 	
					new sap.m.Label({text: "Loja"}),
					new sap.m.ComboBox({width: "300px", items: [{
						"key": "LOJA_00001",
						"text": "LOJA_00001 - TESTE"
					new sap.m.Label({text: 'Auditor'}),
					new sap.m.ComboBox({width: '300px'}),
					new sap.m.Label({text: 'Qtd. Venda'}),
					new sap.m.MaskInput({width: '100px', mask: "99999"}),
					new sap.m.Label({text: 'Preço Concorrente1'}),
					new sap.m.MaskInput({width: '100px'}),
					new sap.m.Label({text: 'Preço Concorrente2'}),
					new sap.m.MaskInput({width: '100px'}),
					new sap.m.Label({text: 'Preço Concorrente3'}),
					new sap.m.MaskInput({width: '100px'})

			sap.ui.getCore().getEventBus().publish("nav", "virtual");
			var dialog = new sap.m.Dialog({
				title: bundle.getText("add_venda_title"),
				content: simpleForm,
				leftButton: addButton,
				rightButton: cancelButton,
				afterClose: afterDialogClose 


Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Nov 04, 2017 at 03:24 AM


    You can use the setModel function like this for your dialog object :


    Hope this helps,


    Add comment
    10|10000 characters needed characters exceeded