Update field value in editable list detail


I'm trying to update value in detail with editable list. And I need to fetch another value that resides in section (the lookup mapped to this detail) and set the fetched value inside the detail.

How to do this in detail with editable list?



Akshaya Gajendran

Like 0




Do you want to fill it on certain conditions or if lookup value was filled in? 

Angela Reyes,

Hi Angela,

I have created detail with editable list in custom section, And there is currency field in section and detail. On click of addRecord(+ button) in detail, i need to get value from currency field in section and set it to the currency field in detail.


Dear Akshaya,

Please see the example of implementation the required functionality below:

1. Detail schema (In my case “UsrCourierServiceDetail”)

define("UsrCourierServiceDetail", ["ConfigurationGrid", "ConfigurationGridGenerator",
    "ConfigurationGridUtilities", "terrasoft"], function(ConfigurationGrid, ConfigurationGridGenerator,
    terrasoft) {
    return {
        // Detail object schema name.
        entitySchemaName: "UsrCourierService",
        // messages 
        messages : {
            "GetOrderTotalAmount": {
                mode: Terrasoft.MessageMode.PTP,
                direction: Terrasoft.MessageDirectionType.PUBLISH
        // Schema attribute list.
        attributes: {
            // Determines whether the editing is enabled.
            "IsEditable": {
                // Data type — logic.
                dataValueType: Terrasoft.DataValueType.BOOLEAN,
                // Attribute type — virtual column of the view model.
                type: Terrasoft.ViewModelColumnType.VIRTUAL_COLUMN,
                // Set value.
                value: true
        // Used mixins.
        mixins: {
            ConfigurationGridUtilities: "Terrasoft.ConfigurationGridUtilities"
           methods : {
               addNewRowToCollection : function(newRow){
               var id = newRow.get("Id");
            var collection = Ext.create("Terrasoft.BaseViewModelCollection");
            var amount = this.sandbox.publish("GetOrderTotalAmount", null, ["GetOrderTotalAmount"]);
            newRow.set("UsrCurrency", amount);
            collection.add(id, newRow);
            var options = this.getAddItemsToGridDataOptions();
            this.addNewRowToGridData(collection, options);
               // Array with view model modifications.
        diff: /**SCHEMA_DIFF*/[
                // Operation type — merging.
                "operation": "merge",
                // Name of the schema element, with which the action is performed.
                "name": "DataGrid",
                // Object, whose properties will be joined with the schema element properties.
                "values": {
                    // Class name
                    "className": "Terrasoft.ConfigurationGrid",
                    // View generator must generate only part of view.
                    "generator": "ConfigurationGridGenerator.generatePartial",
                    // Binding the edit elements configuration obtaining event
                    // of the active page to handler method.
                    "generateControlsConfig": {"bindTo": "generateActiveRowControlsConfig"},
                    // Binding the active record changing event to handler method.
                    "changeRow": {"bindTo": "changeRow"},
                    // Binding the record selection cancellation event to handler method.
                    "unSelectRow": {"bindTo": "unSelectRow"},
                    // Binding of the list click event to handler method.
                    "onGridClick": {"bindTo": "onGridClick"},
                    // Actions performed with active record.
                    "activeRowActions": [
                        // [Save] action setup.
                            // Class name of the control element, with which the action is connected.
                            "className": "Terrasoft.Button",
                            // Display style — transparent button.
                            // Tag.
                            "tag": "save",
                            // Marker value.
                            "markerValue": "save",
                            // Binding button image.
                            "imageConfig": {"bindTo": "Resources.Images.SaveIcon"}
                        // [Cancel] action setup.
                            "className": "Terrasoft.Button",
                            "tag": "cancel",
                            "markerValue": "cancel",
                            "imageConfig": {"bindTo": "Resources.Images.CancelIcon"}
                        // [Delete] action setup.
                            "className": "Terrasoft.Button",
                            "tag": "remove",
                            "markerValue": "remove",
                            "imageConfig": {"bindTo": "Resources.Images.RemoveIcon"}
                    // Binding to method that initializes subscription to events
                    // of clicking buttons in the active row.
                    "initActiveRowKeyMap": {"bindTo": "initActiveRowKeyMap"},
                    // Binding the active record action completion event to handler method.
                    "activeRowAction": {"bindTo": "onActiveRowAction"},
                    // Identifies whether multiple records can be selected.
                    "multiSelect": {"bindTo": "MultiSelect"}


2. Replacing client schema for the section edit page (In my case “OrderPageV2”)

define("OrderPageV2", [], function(){
    return {
        entitySchemaName: "Order",
        messages : {
            "GetOrderTotalAmount": {
                mode: Terrasoft.MessageMode.PTP,
                direction: Terrasoft.MessageDirectionType.SUBSCRIBE
         details: /**SCHEMA_DETAILS*/{
            // [Courier services] detail setup.
            "UsrCourierServiceDetail": {
                // Detail schema name.
                "schemaName": "UsrCourierServiceDetail",
                // Detail object schema name.
                "entitySchemaName": "UsrCourierService",
                // Filtering displayed contacts for current order only.
                "filter": {
                    // Detail object schema column.
                    "detailColumn": "UsrOrder",
                    // Section object schema column.
                    "masterColumn": "Id"
        methods : {
            init : function(){
                this.sandbox.subscribe("GetOrderTotalAmount", this.GetTotalAmount, this, ["GetOrderTotalAmount"]);
            GetTotalAmount : function(){
                var amount = this.get("Amount");
                return amount;
        // Array with modifications.
        diff: /**SCHEMA_DIFF*/[
            // Metadata for adding the [Courier services] detail.
                "operation": "insert",
                // Detail name.
                "name": "UsrCourierServiceDetail",
                "values": {
                    "itemType": Terrasoft.core.enums.ViewItemType.DETAIL,
                    "markerValue": "added-detail"
                // Containers, where the detail is located.
                // Detail is placed on the [Delivery] tab.
                "parentName": "OrderDeliveryTab", 
                "propertyName": "items",
                // Index in the list of added elements.
                "index": 3


In the provided code, In order to get the value from the field in the page I used the module message exchange. Please find more information about it in the article by the link below:

If you have any further question, please contact technical support.

Best regards,




Norton Lingard,

Thanks Norton, Its working great.

Show all comments