How to extend a sap.ui.model.json.JSONModel

sap.ui.define([
	"sap/ui/model/json/JSONModel"
], function(JSONModel) {
	"use strict";

	return JSONModel.extend("<PROJECT_PATH>.model.<NAME>", {

		/**
		 * @class <NAME>
		 * @summary <SUMMARY>
		 * @extends sap.ui.model.json.JSONModel
		 * @param {sap.ui.core.UIComponent} oComponent - Component
		 */
		constructor: function(oComponent) {
			JSONModel.prototype.constructor.call(this, {
				myProperty: undefined
			});
			this._oServiceModel = oComponent.getModel();

		},
		/**
		 * @memberOf <NAME>
		 * @description getXYZ
		 * @public
		 */
		getXYZ: function() {
			//do sth.
		}

	});
});

Leave a Reply

Your email address will not be published. Required fields are marked *