How to add a custom action button to the "Counterparty Address" detail for mobile edit page in Freedom UI
You need to create a custom detail generator(look at the example in Terrasoft.FileAndLinksEmbeddedDetailGenerator)
After that, create schema and add to manifest:
Ext.define("Terrasoft.configuration.CustomEmbeddedDetailGenerator", {
extend: "Terrasoft.EmbeddedDetailGenerator",
generateItem: function() {
var config = this.callParent(arguments);
var cardGenerator = this.getCardGenerator();
var isEdit = cardGenerator.isEdit();
if (isEdit) {
config.xtype = "my_embeddeddetailitem";
}
return config;
}
});
Create detail component with button
Ext.define("Terrasoft.configuration.MyEditEmbeddedDetailItem", {
extend: "Terrasoft.controls.EditEmbeddedDetailItem",
xtype: "my_embeddeddetailitem",
initialize: function () {
this.myButton = Ext.create("Ext.Button", {
text: ""
});
this.myButton.on("tap", this.onMyButtonTap, this);
this.element.appendChild(this.myButton.element);
this.callParent(arguments);
},
onMyButtonTap: function() {
Terrasoft.Geolocation.getCurrentCoordinates({
success: function(latitude, longitude, locationObj) {
},
scope: this
});
}
}
In RecordPageSettings metadata set generator xclass for detail
{
"operation": "insert",
"name": "AccountAddressDetail",
"values": {
"generator": {
"xclass": "Terrasoft.configuration.CustomEmbeddedDetailGenerator"
},
},
"parentName": "settings",
"propertyName": "columnSets",
"index": 3
}
Like