Hi all,
Further to the thread below, is it possible to make a button added to the active row of a detail conditional?
Add button into the active row of detail | Community Creatio
I want to make the button enabled on a certain condition but when I add the enabled and visible values to the Diff of the datagrid, I get no result (tried passing "enabled": false to check it wasn't an issue with the CanSplitFlights method)
define("UsrFlightsDetail", ["ProcessModuleUtilities"], function(ProcessModuleUtilities) {
return {
entitySchemaName: "UsrFlights",
details: /**SCHEMA_DETAILS*/{}/**SCHEMA_DETAILS*/,
diff: /**SCHEMA_DIFF*/[
{
"operation": "merge",
"name": "DataGrid",
"parentName": "Detail",
"propertyName": "items",
"values": {
"activeRowActions": [],
"activeRowAction": {"bindTo": "onActiveRowAction"}
}
},
{
"operation": "insert",
"name": "DataGridActiveRowSplitFlights",
"parentName": "DataGrid",
"propertyName": "activeRowActions",
"values": {
"className": "Terrasoft.Button",
"style": Terrasoft.controls.ButtonEnums.style.BLUE,
"caption": "Split flights",
"tag": "SplitFlights",
"visible": true,
"enabled": CanSplitFlights
}
}
]/**SCHEMA_DIFF*/,
methods: {
CanSplitFlights: function() {
var FlightTypeId = this.getActiveRow().get("UsrFlightType");
var FlightTypeValue = FlightTypeId && FlightTypeId.value;
if (FlightTypeValue == '3a0d3b1b-9af5-472a-bac9-e785500ac4e9') {
return true;
}
return false;
},
onActiveRowAction: function(SplitFlights) {
switch (SplitFlights) {
case "SplitFlights":
this.onSplitFlights();
break;
default:
break;
}
},
onSplitFlights: function(){
ProcessModuleUtilities.executeProcess({
sysProcessName: "UsrSplitFlights",
parameters: {
FlightId: this.getActiveRow().get("Id")
}
});
},