public virtual sap.ui.model.Model createDeviceModel() { var oModel = new sap.ui.model.json.JSONModel(Device); oModel.setDefaultBindingMode(sap.ui.model.BindingMode.OneWay); return(oModel); }
public override void onInit() { var oViewModel = new sap.ui.model.json.JSONModel(new { currency = "EUR" }); this.getView().setModel(oViewModel, "view"); }
public override void onInit() { var oViewModel = new sap.ui.model.json.JSONModel(new UserLoginInfo() { currenUser = "******", lastLogin = DateTime.Now.AddDays(-1) }); this.setModel(oViewModel, "view"); }
public override void onInit() { var oViewModel = new sap.ui.model.json.JSONModel(new { currency = "EUR" }); this.getView().setModel(oViewModel, "view"); var oRouter = sap.ui.core.UIComponent.getRouterFor(this); oRouter.getRoute("detail").attachPatternMatched(_onObjectMatched); }
public override void onInit() { var oViewModel = new sap.ui.model.json.JSONModel(new HomeViewModel() { isPhone = Device.system.phone }); this.setModel(oViewModel, "view"); Device.media.attachHandler((sap.ui.Device.Media.MediaRangeChangeInfo oDevice) => { this.getModelFor <HomeViewModel>("view").setPropertyFor(p => p.isPhone, oDevice.name == "Phone"); }); }
public static void StartupScript() { sap.ui.getCore().attachInit(() => { var oProductModel = new sap.ui.model.json.JSONModel(null); oProductModel.loadData("./bridge/model/Products.json"); sap.ui.getCore().setModel(oProductModel, "products"); // Create a JSON model from an object literal var oModel = new sap.ui.model.json.JSONModel(new { firstName = "Harry", lastName = "Hawk", enabled = true, address = new { street = "Dietmar-Hopp-Allee 16", city = "Walldorf", zip = "69190", country = "Germany" }, salesToDate = 12345.6789, priceThreshold = 20, currencyCode = "EUR" }); // Assign the model object to the SAPUI5 core sap.ui.getCore().setModel(oModel); // Create a resource bundle for language specific texts var oResourceModel = new sap.ui.model.resource.ResourceModel(new sap.ui.model.resource.ResourceModel.ResourceModelInfo() { bundleName = "sap.ui.demo.db.i18n.i18n" }); // Assign the model object to the SAPUI5 core using the name "i18n" sap.ui.getCore().setModel(oResourceModel, "i18n"); // Create view var oView = new sap.ui.core.mvc.XMLView(new sap.ui.core.mvc.XMLView.Settings() { viewName = "sap.ui.demo.db.view.App" } ); // Register the view with the message manager sap.ui.getCore().getMessageManager().registerObject(oView, true); // Insert the view into the DOM oView.placeAt("content"); }); }
public override void init() { // call the init function of the parent base.init(); // set data model var oData = new ViewModel() { recipient = new ViewModel.ViewModelRecipient { name = "World" } }; var oModel = new sap.ui.model.json.JSONModel(oData); this.setModel(oModel); // set i18n model var i18nModel = new sap.ui.model.resource.ResourceModel(new sap.ui.model.resource.ResourceModel.ResourceModelInfo() { bundleName = "sap.ui.demo.walkthrough.i18n.i18n" }); this.setModel(i18nModel, "i18n"); // set invoice model //var invoiceModel = new sap.ui.model.odata.v2.ODataModel("https://cors-anywhere.herokuapp.com/services.odata.org/V2/Northwind/Northwind.svc/"); var invoiceModel = new sap.ui.model.json.JSONModel("/invoices.json"); this.setModel(invoiceModel, "invoice"); // set device model var oDeviceModel = new sap.ui.model.json.JSONModel(jQuery.sap.getObject("sap.ui.Device")); oDeviceModel.setDefaultBindingMode(sap.ui.model.BindingMode.OneWay); this.setModel(oDeviceModel, "device"); // set dialog helloDialog = new HelloDialog(this.getRootControl <sap.ui.core.mvc.View>()); // initialize the routing stuff this.getRouter().initialize(); }
public override void onInit() { var oMessageManager = sap.ui.getCore().getMessageManager(); var oMessageModel = oMessageManager.getMessageModel(); var oMessageModelBinding = oMessageModel.bindList( "/", null, new sap.ui.model.Sorter[] { }, new sap.ui.model.Filter("technical", (Union <sap.ui.model.FilterOperator, object, bool>)sap.ui.model.FilterOperator.EQ, true)); var oViewModel = new sap.ui.model.json.JSONModel(new ViewModel() { busy = false, hasUIChanges = false, usernameEmpty = true, order = 0 }); this.getView().setModel(oViewModel, "appView"); this.getView().setModel(oMessageModel, "message"); oMessageModelBinding.attachChange(onMessageBindingChange); this._bTechnicalErrors = false; }
public override void onInit() { // TODO: change for StErMi/openui5-chartjs var oViewModel = new sap.ui.model.json.JSONModel(new ChartData() { ColumnChartData = new V[] { new V() { v = 80 }, new V() { v = 150 }, new V() { v = 400 }, new V() { v = 200 } }, ColumnChartData2 = new V[] { new V() { v = 40 }, new V() { v = 320 }, new V() { v = 270 }, new V() { v = 140 }, new V() { v = 60 } }, ComparisonChartData = new V[] { new V() { v = 120 }, new V() { v = -67 }, new V() { v = 250 }, new V() { v = -80 } }, ComparisonChartData2 = new V[] { new V() { v = -70 }, new V() { v = 170 }, new V() { v = -30 }, new V() { v = 60 }, new V() { v = 120 } }, PieChartData = new V[] { new V() { v = 83 } }, PieChartData2 = new V[] { new V() { v = 57 } } }); this.setModel(oViewModel, "view"); this.byId <sap.m.Panel>("statisticsContainer").addContent(sap.ui.xmlview(new sap.ui.ViewInfo() { id = this.getView().createId("charts"), viewName = "manu.toolpageapp.fv.view.StatisticsD3" })); }
/// <summary> /// Implement in inheriting classes /// </summary> /// <param name="model">the model to extend</param> /// <param name="pathExpression">the path to where to read the attribute value</param> /// <param name="oContext">the context with which the path should be resolved</param> /// <param name="absolutePath">true if the generated path should be absolute; false otherwise</param> /// <returns>Returns the value for the property with the given sPropertyName</returns> public static TValue getPropertyFor <TModel, TValue>(this sap.ui.model.json.JSONModel <TModel> model, Expression <Func <TModel, TValue> > pathExpression, sap.ui.model.Context oContext, bool absolutePath = true) { return(getPropertyForInternal(model, pathExpression, oContext, absolutePath)); }
/// <summary> /// Sets a new value for the given property <code>sPropertyName</code> in the model. If the model value changed all interested parties are informed. /// </summary> /// <param name="model">the model to extend</param> /// <param name="pathExpression">path of the property to set</param> /// <param name="value">value to set the property to</param> /// <param name="absolutePath">true if the generated path should be absolute; false otherwise</param> /// <returns>true if the value was set correctly and false if errors occurred like the entry was not found.</returns> public static bool setPropertyFor <TModel, TValue>(this sap.ui.model.json.JSONModel <TModel> model, Expression <Func <TModel, TValue> > pathExpression, TValue value, bool absolutePath = true) { return(setPropertyForInternal(model, pathExpression, value, absolutePath)); }