on 11-03-2017 9:25 PM
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
Detail.controller.js
sap.ui.define([
"sap/ui/core/mvc/Controller"
], 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();
oView.bindElement({
path: "/Loja('" + oArgs.arguments.LOJA_COD + "')"
});
},
onAddVenda: function(event){
sap.m.MessageToast.show(event.getSource().getId() + " Pressed");
var bundle = this.getView().getModel("i18n").getResourceBundle();
var cancelButton = new sap.m.Button({
text: bundle.getText("cancel_btn_text"),
press: function(){
dialog.close();
}
});
var addButton = new sap.m.Button({
text: bundle.getText("add_btn_text"),
press: function(){
dialog.close();
}
});
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}"}),
comboTeste,
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
});
dialog.open();
}
});
});
Hi,
You can use the setModel function like this for your dialog object :
oDialog.setModel(
this.getView().getModel("event")
);
Hope this helps,
Regards.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
94 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.