Question

reg alignment

HI team    



 I need one sample one to please how to set that alignment

In the detail i applied a business rule that which mode i selected,then that template should be visible.

For Example:

If i select the communication type as email then email template field should be visible for this i applied business rule.

 

 

If I selected as ivr the alignment position of that was varying

 

I need a case whatever element I selected in communication type, the field which i applied the business rule should come right next to the communication type.

For this what process should I follow.

Hoping For positive reply.

 

 

 

 

 

 

 

 

 

 

 

 

 

Like 0

Like

1 comments

Hello Manikanta!



Here is an example of implementation of the page. As you can see in the code bellow, I have created virtual attribute "DesiredLookup" where info about current displayed field is stored and

method "setFieldVisibility" is writing this info to  the "DesiredLookup" when Lookup value changes. Id of target lookup value can be retrieved from page source, e.g as on screenshot below. 

Please note, that OnEntitityInitialized method should be overridden for displaying fields correctly when page is loading, also check how visibility property of fields are bounded to custom functions.

define("UsrTest1Page", [], function() {
    return {
        entitySchemaName: "UsrTest",
        attributes: {
            "DesiredLookup": {
                "type": Terrasoft.ViewModelColumnType.VIRTUAL_COLUMN,
                "dataValueType": Terrasoft.DataValueType.String,
                "value": ""
            },
            "OnYourOwnLookUpChange":{
                "dependencies":[
                    {
                        "columns":["UsrLookup1"],
                        "methodName":"setFieldVisibility"
                    }]
            }
        },
        modules: /**SCHEMA_MODULES*/{}/**SCHEMA_MODULES*/,
        details: /**SCHEMA_DETAILS*/{
            "Files": {
                "schemaName": "FileDetailV2",
                "entitySchemaName": "UsrTestFile",
                "filter": {
                    "masterColumn": "Id",
                    "detailColumn": "UsrTest"
                }
            }
        }/**SCHEMA_DETAILS*/,
        businessRules: /**SCHEMA_BUSINESS_RULES*/{}/**SCHEMA_BUSINESS_RULES*/,
        methods: {
            onEntityInitialized: function(){
                this.callParent(arguments);
                this.setFieldVisibility();
            },
            setFieldVisibility: function(){
                var currentLookupvalue = this.get("UsrLookup1").value;
                switch (currentLookupvalue) {
                    //hardware value Id
                    case "4eb933c2-d7bb-4711-8d57-3e59c2bcdc0f":
                        this.set("DesiredLookup","YourFirstField");
                        // code
                        break;
                    //additional service Id
                    case "ec4a62b5-9cf0-4e54-abd6-cf509001b2c5":
                        this.set("DesiredLookup","YourSecondField");
                        break;
 
                    default:
                        this.set("DesiredLookup","");
                        break;
                        // code
                }
            },
            getIsField1Visible: function(){
                return this.get("DesiredLookup") === "YourFirstField";
            },
            getIsField2Visible: function(){
                return this.get("DesiredLookup") === "YourSecondField";
            }
        },
        dataModels: /**SCHEMA_DATA_MODELS*/{}/**SCHEMA_DATA_MODELS*/,
        diff: /**SCHEMA_DIFF*/[
            {
                "operation": "insert",
                "name": "UsrNameb6fc7aae-d6f2-47dd-a2e3-ab134daba955",
                "values": {
                    "layout": {
                        "colSpan": 24,
                        "rowSpan": 1,
                        "column": 0,
                        "row": 0,
                        "layoutName": "ProfileContainer"
                    },
                    "bindTo": "UsrName"
                },
                "parentName": "ProfileContainer",
                "propertyName": "items",
                "index": 0
            },
            {
                "operation": "insert",
                "name": "LOOKUP027d441f-8d3a-495d-a9aa-932e46183cc1",
                "values": {
                    "layout": {
                        "colSpan": 24,
                        "rowSpan": 1,
                        "column": 0,
                        "row": 1,
                        "layoutName": "ProfileContainer"
                    },
                    "bindTo": "UsrLookup1",
                    "labelConfig": {
                        "caption": "YourOwnLookUp"
                    },
                    "enabled": true,
                    "contentType": 3
                },
                "parentName": "ProfileContainer",
                "propertyName": "items",
                "index": 1
            },
            {
                "operation": "insert",
                "name": "STRINGfbd8ecc8-ae26-4995-9e04-9ac349699a1d",
                "values": {
                    "layout": {
                        "colSpan": 12,
                        "rowSpan": 1,
                        "column": 0,
                        "row": 0,
                        "layoutName": "Header"
                    },
                    "bindTo": "UsrString1",
                    "labelConfig": {
                        "caption": "YourFirstField"
 
                    },
                    "enabled": true,
                    "visible":{
                        "bindTo":"getIsField1Visible"
                    }
                },
                "parentName": "Header",
                "propertyName": "items",
                "index": 1
            },
            {
                "operation": "insert",
                "name": "STRING4140233f-2c9c-424a-9219-4179e296702c",
                "values": {
                    "layout": {
                        "colSpan": 12,
                        "rowSpan": 1,
                        "column": 0,
                        "row": 0,
                        "layoutName": "Header"
                    },
                    "labelConfig": {
                        "caption": "YourSecondField"
 
                    },
                    "bindTo": "UsrString3",
                    "enabled": true,
                    "visible":{
                        "bindTo":"getIsField2Visible"
                    }
                },
                "parentName": "Header",
                "propertyName": "items",
                "index": 0
            },
            {
                "operation": "insert",
                "name": "STRINGc9085c0d-2393-4ced-a036-bc7a7db9ecd5",
                "values": {
                    "layout": {
                        "colSpan": 12,
                        "rowSpan": 1,
                        "column": 0,
                        "row": 2,
                        "layoutName": "Header"
                    },
                    "bindTo": "UsrString2",
                    "labelConfig": {
                        "caption": "YourAnotherField"
 
                    },
                    "enabled": true
                },
                "parentName": "Header",
                "propertyName": "items",
                "index": 2
            },
            {
                "operation": "insert",
                "name": "NotesAndFilesTab",
                "values": {
                    "caption": {
                        "bindTo": "Resources.Strings.NotesAndFilesTabCaption"
                    },
                    "items": []
                },
                "parentName": "Tabs",
                "propertyName": "tabs",
                "index": 0
            },
            {
                "operation": "insert",
                "name": "Files",
                "values": {
                    "itemType": 2
                },
                "parentName": "NotesAndFilesTab",
                "propertyName": "items",
                "index": 0
            },
            {
                "operation": "insert",
                "name": "NotesControlGroup",
                "values": {
                    "itemType": 15,
                    "caption": {
                        "bindTo": "Resources.Strings.NotesGroupCaption"
                    },
                    "items": []
                },
                "parentName": "NotesAndFilesTab",
                "propertyName": "items",
                "index": 1
            },
            {
                "operation": "insert",
                "name": "Notes",
                "values": {
                    "bindTo": "UsrNotes",
                    "dataValueType": 1,
                    "contentType": 4,
                    "layout": {
                        "column": 0,
                        "row": 0,
                        "colSpan": 24
                    },
                    "labelConfig": {
                        "visible": false
                    },
                    "controlConfig": {
                        "imageLoaded": {
                            "bindTo": "insertImagesToNotes"
                        },
                        "images": {
                            "bindTo": "NotesImagesCollection"
                        }
                    }
                },
                "parentName": "NotesControlGroup",
                "propertyName": "items",
                "index": 0
            }
        ]/**SCHEMA_DIFF*/
    };
});

 

Show all comments