Set default grid behaviour to add row

How would I go about setting the default behaviour for the + button on an editable grid to add a row instead of opening the card?

Specifically, this is the Order page, with the OrderProduct detail.  The + button here

brings up this full page card:

I would like it to default instead to the blank row you get from ... -> New:

I have tried explicitly setting IsEditable to true when initializing the detail, but it doesn't seem to make a difference.  Where might I be able to change this?

Thank you.

Like 0

Like

6 comments

Hello Darian,



Actually, here is an article that describes how to achieve it:

https://academy.bpmonline.com/documents/technic-sdk/7-13/adding-detail-…



Also I have tested it on my local instance, here is an example how to do it with OpportunityProductDetailV2.



1. Create replacing client module for it

2. Put the code from below and save the schema.

 

define("OpportunityProductDetailV2", ["ConfigurationGrid", "ConfigurationGridGenerator",
    "ConfigurationGridUtilities"], function() {
    return {
        entitySchemaName: "OpportunityProductInterest",
        attributes: {
 
            "IsEditable": {
 
                dataValueType: Terrasoft.DataValueType.BOOLEAN,
 
                type: Terrasoft.ViewModelColumnType.VIRTUAL_COLUMN,
                value: true
            }
        },
        mixins: {
            ConfigurationGridUtilities: "Terrasoft.ConfigurationGridUtilities"
        },
        diff: /**SCHEMA_DIFF*/[
            {
                "operation": "merge",
                "name": "DataGrid",
                "values": {
                    "className": "Terrasoft.ConfigurationGrid",
                    "generator": "ConfigurationGridGenerator.generatePartial",
 
                    "generateControlsConfig": {"bindTo": "generateActiveRowControlsConfig"},
                    "changeRow": {"bindTo": "changeRow"},
                    "unSelectRow": {"bindTo": "unSelectRow"},
                    "onGridClick": {"bindTo": "onGridClick"},
                    "activeRowActions": [
                        {
                            "className": "Terrasoft.Button",
                            "style": this.Terrasoft.controls.ButtonEnums.style.TRANSPARENT,
                            "tag": "save",
                            "markerValue": "save",
                            "imageConfig": {"bindTo": "Resources.Images.SaveIcon"}
                        },
                        {
                            "className": "Terrasoft.Button",
                            "style": this.Terrasoft.controls.ButtonEnums.style.TRANSPARENT,
                            "tag": "cancel",
                            "markerValue": "cancel",
                            "imageConfig": {"bindTo": "Resources.Images.CancelIcon"}
                        },
                        {
                            "className": "Terrasoft.Button",
                            "style": this.Terrasoft.controls.ButtonEnums.style.TRANSPARENT,
                            "tag": "remove",
                            "markerValue": "remove",
                            "imageConfig": {"bindTo": "Resources.Images.RemoveIcon"}
                        }
                    ],
                    "initActiveRowKeyMap": {"bindTo": "initActiveRowKeyMap"},
                    "activeRowAction": {"bindTo": "onActiveRowAction"},
                    "multiSelect": {"bindTo": "MultiSelect"}
                }
            }
        ]/**SCHEMA_DIFF*/
    };
});

 

Alex_Tim,

I have done that, but it doesn't make a difference.  It does function as expected with OpportunityProductInterest, but OrderProduct still requires using ...->New to get a new line.

REf:

define("OrderProductDetailV2", ["ConfigurationGrid", "ConfigurationGridGenerator",
	"ConfigurationGridUtilities"], function() {
	return {
		entitySchemaName: "OrderProduct",
		attributes: {
			"IsEditable": {
				dataValueType: Terrasoft.DataValueType.BOOLEAN,
				type: Terrasoft.ViewModelColumnType.VIRTUAL_COLUMN,
				value: true
			}
		},
		mixins: {
			ConfigurationGridUtilities: "Terrasoft.ConfigurationGridUtilities"
		},
		details: /**SCHEMA_DETAILS*/{}/**SCHEMA_DETAILS*/,
		diff: /**SCHEMA_DIFF*/[
			{
				"operation": "merge",
				"name": "DataGrid",
				"values": {
					"className": "Terrasoft.ConfigurationGrid",
					"generator": "ConfigurationGridGenerator.generatePartial",
					"generateControlsConfig": {"bindTo": "generateActiveRowControlsConfig"},
					"changeRow": {"bindTo": "changeRow"},
					"unSelectRow": {"bindTo": "unSelectRow"},
					"onGridClick": {"bindTo": "onGridClick"},
					"activeRowActions": [
						// [Save] action setup.
						{
							"className": "Terrasoft.Button",
							"style": this.Terrasoft.controls.ButtonEnums.style.TRANSPARENT,
							"tag": "save",
							"markerValue": "save",
							"imageConfig": {"bindTo": "Resources.Images.SaveIcon"}
						},
						// [Cancel] action setup.
						{
							"className": "Terrasoft.Button",
							"style": this.Terrasoft.controls.ButtonEnums.style.TRANSPARENT,
							"tag": "cancel",
							"markerValue": "cancel",
							"imageConfig": {"bindTo": "Resources.Images.CancelIcon"}
						},
						// [Delete] action setup.
						{
							"className": "Terrasoft.Button",
							"style": this.Terrasoft.controls.ButtonEnums.style.TRANSPARENT,
							"tag": "remove",
							"markerValue": "remove",
							"imageConfig": {"bindTo": "Resources.Images.RemoveIcon"}
						}
					],
					"initActiveRowKeyMap": {"bindTo": "initActiveRowKeyMap"},
					"activeRowAction": {"bindTo": "onActiveRowAction"},
					"multiSelect": false
				}
			}
		]/**SCHEMA_DIFF*/,
		methods: {}
	};
});

 

Darian Lewis,

Basically, I tried to apply the code that you sent and it works in a required way if you are trying to add the product via "new" button

http://prntscr.com/mprbvm



To make "plus" button behave as "new" button you should override the logic of the plus button.



Best regards,

Alex

Alex_Tim writes:

To make "plus" button behave as "new" button you should override the logic of the plus button.

Yes, that's what I'm asking for help with - I can't find where to override the plus button.

Darian Lewis,

The logic of "plus" button lays in "BaseGridDetailV2 module. This button is binded to "addRecord" method.

The logic of "new" button lays in "ConfigurationGridUtilities" module. This button is binded to "addRow" method.



So the solution is to override "plus" button and bind it to "addRow" method.



To achieve it, new replacing client module for "OrderProductDetailV2"  should be created and

the code from below should be inserted into the module.



define("OrderProductDetailV2", ["ConfigurationGridUtilities"], function() {

    return {

        entitySchemaName: "OrderProduct",

        messages: {},

        attributes: {},

        methods: {},

        diff: /**SCHEMA_DIFF*/[

            {

                "operation": "merge",

                "name": "AddRecordButton",

                "values": {

                    "click":{"bindTo":"addRow"}

                }

            }

        ]/**SCHEMA_DIFF*/

    };

});

 

Alex_Tim,

Thank you, that did the trick.

Show all comments