sapui5

Can't bind property from model to control on XML view

半城伤御伤魂 提交于 2021-02-08 10:40:20
问题 I trying to migrate my app on new version of Openui5 (1.48) and have some problems with model bindings. I am using sap.ui.getCore().setModel(oModel, "local") for model declaration and when I trying to bind some controls to values from this model like this: <Text text="{local>/count}"/> value isn't displayed but if I will get this model, set it to view in controller and remove > from xml var oModel = sap.ui.getCore().getModel("local"); this.getView().setModel(oModel); XML <Text text="{/count}"

CompositeBinding with TwoWay Binding Mode

女生的网名这么多〃 提交于 2021-02-08 08:36:45
问题 I try to use the same SimpleForm for creating a new object and for editing. I try to make it this way: <Input value="{= !${/isNew} ? ${som>Id} : ${newModel>Id}" /> But the bindings are not in mode TwoWay. Is there a possibility to make it to TwoWay Binding? 回答1: In property binding, using ... Expression Binding Binding with string literals Multiple binding parts with a formatter ... turns the binding mode into OneWay (or even OneTime in case of {:= in Expression Binding). They all make use of

warning to use new asynchronous factory 'sap.ui.core.mvc.Controller.create(…)'

拥有回忆 提交于 2021-02-08 08:24:39
问题 Following the openui5 tutorial with some deviations I get the following warning when I serve the dev version of the app: Do not use synchronous controller creation for controller 'sap.ui.demo.walkthrough.controller.HelloPanel'! Use the new asynchronous factory 'sap.ui.core.mvc.Controller.create(...)' instead. In webapp/view/App.view.xml the HelloPanel view is referenced as in the tutorial, that is with: <mvc:XMLView viewName="sap.ui.demo.walkthrough.view.HelloPanel"/> If I serve the

Event parameter overwritten after change event?

徘徊边缘 提交于 2021-02-08 02:10:43
问题 In view: <List selectionChange="onSelectionChange"> In controller: onSelectionChange : function (oEvent) { console.log(oEvent.sId); //log 1, output "selectionChange" MessageBox.warning(Utils.i18n("CHANGE_CONFIRM"), { actions: [Utils.i18n("LEAVE_BTN"), MessageBox.Action.CANCEL], onClose: function(sAction) { console.log(oEvent.sId); //log 2, output "closed" if(sAction === Utils.i18n("LEAVE_BTN")) { this._showDetail(oEvent.getParameter("listItem") || oEvent.getSource(), oEvent.getSource().data(

How to enable auto focus on SAPUI5 input suggestion field

点点圈 提交于 2021-02-07 10:31:37
问题 I'm currently developing a sapui5 mobile application and am using an sap.m.Input with suggestions bound by a model like this: new Page('page', { showNavButton: true, content: [ new sap.m.Input({ id: "input", type: 'Text', showSuggestion: true, suggestionItemSelected: function(event) { event.getParameters().selectedItem.mProperties.text; }, liveChange: function() { // some stuff } }) ] }); The Model is created and bound like the following: var model = new sap.ui.model.json.JSONModel(); //

How to enable auto focus on SAPUI5 input suggestion field

牧云@^-^@ 提交于 2021-02-07 10:31:18
问题 I'm currently developing a sapui5 mobile application and am using an sap.m.Input with suggestions bound by a model like this: new Page('page', { showNavButton: true, content: [ new sap.m.Input({ id: "input", type: 'Text', showSuggestion: true, suggestionItemSelected: function(event) { event.getParameters().selectedItem.mProperties.text; }, liveChange: function() { // some stuff } }) ] }); The Model is created and bound like the following: var model = new sap.ui.model.json.JSONModel(); //

Parse XML View from String

天涯浪子 提交于 2021-02-05 08:25:42
问题 Is it possible to parse an XML string and use it as a UI5 view? I like to do something like this: var sXML = `<mvc:View xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m" controllerName="controller.App" displayBlock="true" > <App>...</App> </mvc:View>`; var oView = sap.ui.view({ id: "idstart1", view: sXML, type: "XML" }); 回答1: Sure, by defining the property viewContent with the string in sap.ui.xmlview , it's possible as the API reference states: viewContent [...] can hold a view description as XML

UI5 custom control, data binding not working when used in a table

落花浮王杯 提交于 2021-02-05 06:58:47
问题 I have problems with data binding of my custom control. My control inherits from sap.m.Input and extends it with a special value helper. One of my new properties of my new control is a simple header for the value help dialog. This is bound to an i18n model. When I now use my control in a normal form, everything works. The title is bound correctly and shows the value of the bound i18n property in that model. If I use my control as a template in a column of a sap.ui.table control, it only shows

UI5 custom control, data binding not working when used in a table

僤鯓⒐⒋嵵緔 提交于 2021-02-05 06:57:28
问题 I have problems with data binding of my custom control. My control inherits from sap.m.Input and extends it with a special value helper. One of my new properties of my new control is a simple header for the value help dialog. This is bound to an i18n model. When I now use my control in a normal form, everything works. The title is bound correctly and shows the value of the bound i18n property in that model. If I use my control as a template in a column of a sap.ui.table control, it only shows

Is it possible to bind sap.ui.base.ManagedObject to the view?

大兔子大兔子 提交于 2021-02-04 12:43:04
问题 I have a view that shows the employee name in the sap.m.Input control as below <mvc:View controllerName="com.naveen.test.managedobject.controller.Employee" xmlns="sap.m" xmlns:mvc="sap.ui.core.mvc" height="100%" > <Input value="{/name}" liveChange="onDataChange" type="Text" /> </mvc:View> And the model class is as shown here based on this hint. sap.ui.define([ "sap/ui/base/ManagedObject" ], function(ManagedObject) { "use strict"; return ManagedObject.extend("com.naveen.test.managedobject