Hi,
I am following this old tutorial and seems like not working for me.
May I know if there's any new way to do this?
I am receiving the following error:
message: Error: Script error for "UsrMyMenuStructure"
Here's my code segments.
Communication Panel:
define("CommunicationPanel", ["terrasoft", "CommunicationPanelHelper"],
function(Terrasoft, CommunicationPanelHelper) {
return {
messages: {
"SelectCommunicationPanelItem": {
"mode": Terrasoft.MessageMode.PTP,
"direction": Terrasoft.MessageDirectionType.SUBSCRIBE
}
},
attributes: {
"UsrMyMenuActive": {
"dataValueType": Terrasoft.DataValueType.BOOLEAN,
"type": Terrasoft.ViewModelColumnType.VIRTUAL_COLUMN,
"value": false
},
"UsrMyMenuCounter": {
"dataValueType": Terrasoft.DataValueType.TEXT,
"type": Terrasoft.ViewModelColumnType.VIRTUAL_COLUMN,
"value": ""
},
"UsrMyMenuVisible": {
"dataValueType": Terrasoft.DataValueType.BOOLEAN,
"type": Terrasoft.ViewModelColumnType.VIRTUAL_COLUMN,
"value": true
}
},
methods: {
getPanelItemConfig: function(moduleName) {
var config = this.callParent(arguments);
if (moduleName !== "UsrMyMenuModule") {
return config;
}
return Ext.apply(config, {
keepAlive: false
});
},
selectItem: function(config) {
this.set("SelectedMenuItem", config.selectedItem);
},
getUsrMyMenuImageConfig: function(itemTag) {
return this.get("Resources.Images.VisaMenuIcon");
}
},
diff: [
{
"operation": "insert",
"index": 0,
"parentName": "communicationPanelContent",
"propertyName": "items",
"name": "usrMyMenu",
"values": {
"tag": "UsrMyMenu",
"visible": {"bindTo": "UsrMyMenuVisible"},
"imageConfig": {"bindTo": "getUsrMyMenuImageConfig"},
"generator": "CommunicationPanelHelper.generateMenuItem"
}
}
]
};
});
UsrMyMenuModule
define("UsrMyMenuModule", [], function() {
Ext.define("Terrasoft.configuration.UsrMyMenuModule", {
extend: "Terrasoft.BaseSchemaModule",
alternateClassName: "Terrasoft.UsrMyMenuModule",
generateViewContainerId: false,
initSchemaName: function() {
this.schemaName = "UsrMyMenu";
},
initHistoryState: Terrasoft.emptyFn,
init: function() {
this.callParent(arguments);
this.initMessages();
},
initMessages: function() {
/*this.sandbox.subscribe("RerenderModule", function(config) {
if (this.viewModel) {
this.render(this.Ext.get(config.renderTo));
return true;
}
}, this, [this.sandbox.id]);*/
},
createViewModel: function() {
var viewModel = this.callParent(arguments);
return viewModel;
}
});
return Terrasoft.UsrMyMenuModule;
});
UsrMyMenu
define("UsrMyMenu", [], function() {
return {
methods: {
init: function(callback, scope) {
this.callParent([function() {
callback.call(scope);
}, this]);
},
onTestClick: function() {
alert(1);
}
},
diff: [
//MyMenu
{
"operation": "insert",
"name": "MyMenu",
"propertyName": "items",
"values": {
"generateId": false,
"itemType": Terrasoft.ViewItemType.CONTAINER,
"items": []
}
},
//ShowNewMessagesButton
{
"operation": "insert",
"name": "ShowNewMessagesButton",
"parentName": "MyMenu",
"propertyName": "items",
"values": {
"generateId": false,
"itemType": Terrasoft.ViewItemType.BUTTON,
"caption": "Test!",
"click": {bindTo: "onTestClick"}
}
}
]
};
});
Reference:
https://community.creatio.com/articles/how-can-i-add-button-communicati…
Best Regards,
Solem.