Skip to Content
0
Sep 28, 2020 at 01:52 PM

Aggregation does not exit in Element

40 Views Last edit Sep 28, 2020 at 02:03 PM 2 rev

Hello!

I have a few custom controls in my app that extend stardard SAPUI5 1.71.5 controls. And sometimes during page initialization an unclear error occurs:

"Aggregation "tokenizer" does not exit in Element crm.lib.controls.dialog.ClientDialog#__xmlview"

This could happen with different dialogs that use the same inheritance from the Base dialog that extends MultiInput. Its used to set MultiInput's tokens from multiple values selected in dialog.

From error debugging, I realized that the metadata of Client dialog sometimes does not contain "token" and "tokenizer" aggregations, but I can't figure out why. So MultiInput's initialization falls on validateAggregation method with above-stated error.

Is it the extend method issue?

For example here's the code of my custom Client dialog and Base dialog controls:

sap.ui.define([
	"crm/lib/base/BaseVhDialog",
...
], function (BaseVhDialog, ...) {
	"use strict";
	var oClientDialog = BaseVhDialog.extend("crm.lib.controls.dialog.ClientDialog", {
		metadata: {
			properties: {
				oldKey: {
					type: "string"
				}
			}
		},
		renderer: "sap.m.MultiInputRenderer"
	});

	oClientDialog.prototype.init = function () {
		BaseVhDialog.prototype.init.call(this, arguments);
        ...

------------------------------------------------

sap.ui.define([
	"sap/m/MultiInput",
...
], function (MultiInput, ...) {
	"use strict";
	var oDialog = MultiInput.extend("crm.lib.base.BaseVhDialog", {
		metadata: {
			properties: {
                          ...
			},
			events: {
				select: {}
			},
			aggregations: {
				_valueHelpIcon: {
					type: "sap.ui.core.Control",
					multiple: false,
					visibility: "hidden"
				}
			}
		},
		renderer: "sap.m.MultiInputRenderer",
	});

	oDialog.prototype.init = function () {
		MultiInput.prototype.init.call(this, arguments);
        ...
	oDialog.prototype.onBeforeRendering = function () {
		MultiInput.prototype.onBeforeRendering.call(this, arguments);
        ...