Hi community,
I'd like to add button on a active row in a data grid :
For that I found posts on the community that explain how to achieve that :
https://community.creatio.com/questions/alteradd-row-buttons-newly-crea…
https://community.creatio.com/questions/add-button-row-section
https://community.creatio.com/articles/add-button-active-row-detail
https://community.creatio.com/questions/override-section-open-record-bu…
I tried to follow them. Here is my code :
define("ContactSectionV2", ["ProcessModuleUtilities"], function(ProcessModuleUtilities) { return { entitySchemaName: "Contact", details: /**SCHEMA_DETAILS*/{}/**SCHEMA_DETAILS*/, diff: /**SCHEMA_DIFF*/[ { "operation": "insert", "name": "BtnRowCreateCandidature", "parentName": "DataGrid", "propertyName": "activeRowActions", "values": { "className": "Terrasoft.Button", "style": Terrasoft.controls.ButtonEnums.style.BLUE, "tag": "DataGridCandidature", "caption": { "bindTo": "Resources.Strings.BtnRowCreateCandidatureCaption" }, "hint": { "bindTo": "Resources.Strings.BtnCreateCandidatureHint" }, } } ]/**SCHEMA_DIFF*/, methods: { onActiveRowAction: function(buttonTag, primaryColumnValue){ this.callParent(arguments); switch(buttonTag){ case "DataGridCandidature": this.myCustomFunction(primaryColumnValue); break; } }, myCustomFunction: function(primaryColumnValue){ this.showInformationDialog(primaryColumnValue); }, } }; });
But for some reasons, the newly created button never showed up.
Is this the right way to create a button in a datagrid row ?
Best regards,
Julien Gunther
Like
Hello Julien,
I've used the following approach:
define("ContactSectionV2", ["ContactSectionV2Resources"], function(resources) { return { entitySchemaName: "Contact", details: /**SCHEMA_DETAILS*/{}/**SCHEMA_DETAILS*/, diff: /**SCHEMA_DIFF*/[ { "operation": "insert", "name": "DataGridActiveRowTestButtonAdding", "parentName": "DataGrid", "propertyName": "activeRowActions", "values": { "className": "Terrasoft.Button", "style":this.Terrasoft.controls.ButtonEnums.style.BLUE, "markerValue": "TestButtonAddingAction", "tag": "call", "caption": resources.localizableStrings.TestButtonAddingRowButtonCaption } } ]/**SCHEMA_DIFF*/, methods: { onActiveRowAction: function(buttonTag, primaryColumnValue) { switch (buttonTag) { case "call": this.testClick(primaryColumnValue); break; default: this.callParent(arguments); break; } }, testClick: function(recordId) { this.console.log("The button is clicked!"); } } }; });
Using localizable resources of the schema. It seems that in your code the module doesn't load the localizable string for "BtnRowCreateCandidatureCaption" key. In my code the string value was loaded and the button is present in active row:
Best regards,
Oscar
Hello Julien,
I've used the following approach:
define("ContactSectionV2", ["ContactSectionV2Resources"], function(resources) { return { entitySchemaName: "Contact", details: /**SCHEMA_DETAILS*/{}/**SCHEMA_DETAILS*/, diff: /**SCHEMA_DIFF*/[ { "operation": "insert", "name": "DataGridActiveRowTestButtonAdding", "parentName": "DataGrid", "propertyName": "activeRowActions", "values": { "className": "Terrasoft.Button", "style":this.Terrasoft.controls.ButtonEnums.style.BLUE, "markerValue": "TestButtonAddingAction", "tag": "call", "caption": resources.localizableStrings.TestButtonAddingRowButtonCaption } } ]/**SCHEMA_DIFF*/, methods: { onActiveRowAction: function(buttonTag, primaryColumnValue) { switch (buttonTag) { case "call": this.testClick(primaryColumnValue); break; default: this.callParent(arguments); break; } }, testClick: function(recordId) { this.console.log("The button is clicked!"); } } }; });
Using localizable resources of the schema. It seems that in your code the module doesn't load the localizable string for "BtnRowCreateCandidatureCaption" key. In my code the string value was loaded and the button is present in active row:
Best regards,
Oscar