Hi community!

I add a button section but i want it don't show when I open edit page. In this case, i add a section button on Contact Section. I show images below

Regards,

Thanks you!

Like 0

Like

4 comments

Hello Ezequiel,



You need to define an attribute that will determine the visibility of your button. By default, it will be true. Then you need to override onCardRendered method in your replacing schema for Contact Section and set the attribute as false.

Please, see my example:

 

define("ContactSectionV2", [],

    function() {

    return {

        entitySchemaName: "Contact",

        attributes: {

            "ButtonVisible": {

                "dataValueType": Terrasoft.DataValueType.BOOLEAN,

                "type": Terrasoft.ViewModelColumnType.VIRTUAL_COLUMN,

                "value": true

            }

        },

        messages: {},

        methods: {

             onCardRendered: function() {

                 this.callParent();

                 this.set("ButtonVisible", false);

             }

        },

        diff: /**SCHEMA_DIFF*/[

            {

                "operation": "insert",

                "parentName": "ActionButtonsContainer",

                "propertyName": "items",

                "name": "MainContactSectionButton",

                "values": {

                    itemType: Terrasoft.ViewItemType.BUTTON,

                    caption: { bindTo: "Resources.Strings.TestButton" },

                    "visible": {bindTo: "ButtonVisible"},

                    "layout": {

                        "column": 1,

                        "row": 6,

                        "colSpan": 1

                    }

                }

            }

        ]/**SCHEMA_DIFF*/

    };

});

 

Tetiana Markova,

Hi! I wanted to use this code also, but i have a question. Where do I insert the name of my button? 

Tetiana Markova,

 

I don't know if you are still following this thread, but the problem with this method is that when the user closes the edit page the button is not restored to the section list page.  Any solution?

 

Thanks,

The way I got round the above was to include the following method:

			showSection: function() {
				this.callParent();
				this.set("ButtonVisible", true);
			},

This reshows the buttons.  This is purely a hack and unofficial, caveat emptor.

Show all comments

Hi community!

How are you?

How could I add a button on row section?

Thanks you!

Regards,

Ezequiel!

Like 0

Like

2 comments

Please investigate the code in the basesectionv2 module. Please use google chrome dev tools for the investigation.

You can create a replacing client module for the section and add the button in the same way as other buttons were added. 

http://prntscr.com/kqgyym

Additionally, you'll need to override the "onActiveRowAction" method and add a handler for the button. 

http://prntscr.com/kqgzs4

 

Miroslav Kytka,

define("AccountSectionV2", ["AccountSectionV2Resources"], function(resources) {
	return {
		entitySchemaName: "Account",
		details: /**SCHEMA_DETAILS*/{}/**SCHEMA_DETAILS*/,
		diff: /**SCHEMA_DIFF*/[
			{
				"operation": "insert",
				"name": "MyCustomLockAction",
				"parentName": "DataGrid",
				"propertyName": "activeRowActions",
				"values": {
					"className": "Terrasoft.Button",
					"style": Terrasoft.controls.ButtonEnums.style.BLUE,
					"caption": resources.localizableStrings.UsrLockCaption, 
					"tag": "lock",
					"enabled": true,
					"visible": true
				}
			}
		]/**SCHEMA_DIFF*/,
		methods: {}
	};
});

 

Show all comments

 

I have a case, I want to make two or more buttons on a page.

I've create it, but only one button appears, the second button doesn't appear.

When I refresh the page, a second button appears. Below screenshoot and the code that I use to make these 2 buttons.

Source code in section: 

define("UsrExampleBtn1Section", [], function() {
	return {
        entitySchemaName: "UsrExampleBtn",
        methods: {
            onClickTest1: function() {
                console.log("Test 1 Button Clicked..");
            },
            onClickTest2: function() {
                console.log("Test 2 Button Clicked..");
            },
        },
		diff: /**SCHEMA_DIFF*/[
            /**
             * Element Test Button 1
             */
            {
                "operation": "insert",
                "parentName": "CombinedModeActionButtonsCardLeftContainer",
                "propertyName": "items",
                "name": "Test1Btn",
                "values": {
                    itemType: Terrasoft.ViewItemType.BUTTON,
                    caption: {
                        bindTo: "Resources.Strings.TestBtn1Caption"
                    },
                    click: {
                        bindTo: "onClickTest1"
                    },
                    "style": Terrasoft.controls.ButtonEnums.style.BLUE,
                }
            },
 
            /**
             * Element Test Button 2
             */
            {
                "operation": "insert",
                "parentName": "CombinedModeActionButtonsCardLeftContainer",
                "propertyName": "items",
                "name": "Test2Btn",
                "values": {
                    itemType: Terrasoft.ViewItemType.BUTTON,
                    caption: {
                        bindTo: "Resources.Strings.TestBtn2Caption"
                    },
                    click: {
                        bindTo: "onClickTest2"
                    },
                    "style": Terrasoft.controls.ButtonEnums.style.GREEN
                }
            },
 
        ]/**SCHEMA_DIFF*/,
        details: /**SCHEMA_DETAILS*/{}/**SCHEMA_DETAILS*/,
	};
});

Source code in page:

define("UsrExampleBtn1Page", [], function() {
	return {
		entitySchemaName: "UsrExampleBtn",
        methods: {
            onClickTest1: function() {
                console.log("Clicked Test Button 1");
			},
            onClickTest2: function() {
                console.log("Clicked Test Button 2");
            },
        },
		diff: /**SCHEMA_DIFF*/[
 
			/**
             * Element Test Button 1
             */
            {
                "operation": "insert",
                "parentName": "LeftContainer",
                "propertyName": "items",
                "name": "Test1Btn",
                "values": {
                    itemType: Terrasoft.ViewItemType.BUTTON,
                    caption: {
                        bindTo: "Resources.Strings.TestBtn1Caption"
                    },
                    click: {
                        bindTo: "onClickTest1"
                    },
                    "style": Terrasoft.controls.ButtonEnums.style.BLUE
                }
			},
 
			/**
             * Element Test Button 2
             */
            {
                "operation": "insert",
                "parentName": "LeftContainer",
                "propertyName": "items",
                "name": "Test2Btn",
                "values": {
                    itemType: Terrasoft.ViewItemType.BUTTON,
                    caption: {
                        bindTo: "Resources.Strings.TestBtn2Caption"
                    },
                    click: {
                        bindTo: "onClickTest2"
                    },
                    "style": Terrasoft.controls.ButtonEnums.style.GREEN
                }
			},
		]/**SCHEMA_DIFF*/,
	};
});

Is there something wrong in my code? I have checked the console, but there is no error. any solution for my case? Thanks



*SOLVED

Add all button caption in section and page

Like 1

Like

4 comments

Dear Romadan,

It seems you have forgot to add the caption "TestBtn2Caption" in Section schema.

I have added the same buttons with 2 captions both in Section and Page schemas and they are displayed correctly, but once I delete the caption in Section schema I was able to see the same results - the second button was appearing only after I refresh the page.

Please check the caption in the Section schema and make sure it is added correctly.

Oleh

 

I check caption 'TestBtn2Caption' in schema, and I forgot to add.

Thanks Oleh.

 

Dear Romadan & Oleh,



This case is same with my problem.

Thank you for this post and solved very helpful.



Ali

Dear Romadan,

Don't forget about me.

Show all comments

Hi community!

How are you?

I hope you can help me!

How can I add a button in row datagrid of Products? I add a image below showing in red color where I need add the button!

King Regards,

 

Ezequiel

Like 0

Like

1 comments

Please investigate how the "activeRowActionOpenCard" button was added into the "SupplyPaymentDetailV2" module. Please feel free to create your own container and apply your CSS in order to create the left button. The handler for the buttons is in the "onActiveRowAction" method in the "ConfigurationGridUtilities" module. Please put a breakpoint and click on the button on a record in the "Installment plan" detail on the "Order" page. You'll see how to handle the click. Please note that you can override the "onActiveRowAction" method on the detail schema. 

Please read bpm'online development guide for more information.

Show all comments

Is it possible to put a button (or custom link) on the side bar, where sections are? If it's not possible with the current framework - do you think it would break something if such button was placed there using jQuery?

Like 0

Like

2 comments

Dear Carlos,

You may try add a usual custom section, put it at any workplace you want and then override init function in section module:

init: function() { window.location.href = "http://bpmonline.com"; }

After clicking on this section http://bpmonline.com page will be opened.

If everything works fine you can delete all unnecessary code created by Section Wizard leaving only the needed one to your section work properly.

You may add everything on the page using jquery but you should be careful with it. Of course you can break something if do it in a wrong way but it's related to any code that developers write.

Thank you very much, it worked.

Show all comments

Need to add a button on the accounts page next to a new text field.  Something similar to the web field in the communications options:

I need to be able to enter a text value like: “asd234” into the field to be stored as an “external account id”. 

Then be able to click the button at the end to display a webpage in another tab with an url like:

https://somewebsite.com/asd234

I was planning on using a System Setting to store the URL root https://somewebsite.com/ and then just append the “external account id” field.

I envision the button click code to be something like (pseudo code):

If (account.externalaccountid <> '') {
	Var URL = get-system-setting(“external website root”) + 
              account.externalaccountid;
	DisplayWebPage(URL);
}

NOTE: the functionality of the Web field is what I want except that I need it in another section under “billing” and need to store just the “external account id” – not the whole URL.

 

Like 0

Like

1 comments

Dear Brian,

How to add a button to any place of the page is described here.

The example with communication options from your screenshot you will find in the ContactCommunicationDetailV2 schema:

{

                    "operation": "insert",

                    "name": "CommunicationsContainer",

                   ...

                    {

                       ...

                        onGetItemConfig: "getItemViewConfig"

                    }

...

The code above fills in the communication container with input and button elements by calling getItemViewConfig function. You can read that function to see, how it creates the buttons with images and clicks.

Show all comments

Hello!

I hope you can help me!

I want to hide the "Contact" button from the Quick Add Menu

How could I do this?

King Regards,

Ezequiel

Like 0

Like

1 comments

Hi,

There is the lookup called  Quick Add menu setup:

Image.png



You can apply the necessary changes there. Please note that you need to log out and back it for the changes to be applied. 

Show all comments

Hello!

how are you?

I hope your can help me!

I have a button in EmployeePage, when I press the button call to method "downloadFile" in property "click". I want call to this method from various bottons but passing a distinct parameter for each button. Example:

{
		"operation": "insert",
		"name": "DownloadFileButton",
		"values": {
			"itemType": 5,
			"imageConfig": {
				"bindTo": "Resources.Images.FilesImage"
			},
			"click": {
				"bindTo": "downloadFile"
                //Pass parameter
			},
			"visible": true
			"enabled": {
				"bindTo": "UsrClaveAltaTemprana"
			},
			//Button Tooltip
			"hint": {  
				"bindTo": "Resources.Strings.MensajeTooltipDownload" 	
			},
			"markerValue": "DownloadFileButton",
			"layout": {
				"colSpan": 1,
				"rowSpan": 1,
				"column": 11,
				"row": 0
			}
		},
		"parentName": "Taba317b6dcTabLabelGridLayout3826b978",
		"propertyName": "items",
		"index": 1
	},
{
		"operation": "insert",
		"name": "DownloadFileButton2",
		"values": {
			"itemType": 5,
			"imageConfig": {
				"bindTo": "Resources.Images.FilesImage"
			},
			"click": {
				"bindTo": "downloadFile"
                //pass parameter
			},
			"visible": true
			"enabled": {
				"bindTo": "UsrClaveBajaTemprana"
			},
			//Button Tooltip
			"hint": {  
				"bindTo": "Resources.Strings.MensajeTooltipDownload" 	
			},
			"markerValue": "DownloadFileButton2",
			"layout": {
				"colSpan": 1,
				"rowSpan": 1,
				"column": 11,
				"row": 1
			}
		},
		"parentName": "Taba317b6dcTabLabelGridLayout3826b978",
		"propertyName": "items",
		"index": 1
	},
//method
methods: {
//method with parameter
			downloadFile: function(parameter) {
             var p = parameter;
             if (p == "A")
               //do some thing
             else
               //do some thing
            }

I appreciated your help!

King Regards!

Ezequiel Gómez

Like 0

Like

4 comments

Dear Ezaquiel,

The code you've provided above will work in case you add the appropriate Set parameter to UsrClaveAltaTemprana and UsrClaveBajaTemprana.

We suggest you to add the virtual attribute ,though. You can find the example of the attribute in various schemas in the configuration. 

Lisa

Hello,

 

I have exactly the same request, but I don't understand the answer.

Can you explain this in a little more detail?

 

How can i pass a parameter to the downloadFile 

"click": {

                "bindTo": "downloadFile"

}

Hi Oliver, how are you? Below an script example. Let me know if it work for you:

{

                "operation": "insert",

                "name": "downloadTest",

                "values": {

                    "itemType": 5,

                    "imageConfig": {

                        "bindTo": "Resources.Images.IconoDescargar"

                    },

                    "click": {

                        "bindTo": "downloadTest"

                    },

                    "visible": {

                        "bindTo": "UsrdownloadTest"

                    },

                    "hint": {

                        "bindTo": "Resources.Strings.MensajeTooltipDownload"

                    },

                    "layout": {

                        "colSpan": 1,

                        "rowSpan": 1,

                        "column": 18,

                        "row": 6

                    }

                },

                "parentName": "Tabe14d1848TabLabelGridLayout4868277b",

                "propertyName": "items",

                "index": 25

            }

//////////////////////**////////////////////////////////////////

downloadTest: function() {

                var esqEmpDocument = this.Ext.create("Terrasoft.EntitySchemaQuery", {

                    rootSchemaName: "UsrEmployeeDocument"

                });

                esqEmpDocument.addColumn("Id", "IdDocumento");

                esqEmpDocument.addColumn("Name", "NombreDocumento");

                //Filtro por Empleado

                var filtroEmpleado = esqEmpDocument.createColumnFilterWithParameter(Terrasoft.ComparisonType.EQUAL, "UsrEmpleado.Id", this.get("Id"));

                //Filtro por Id de empleado

                var filtroTipoDoc = esqEmpDocument.createColumnFilterWithParameter(Terrasoft.ComparisonType.EQUAL, "UsrCodDocumento", "MA");

                //Agrego filtros a la consulta

                esqEmpDocument.filters.add("filtroEmpleado", filtroEmpleado);

                esqEmpDocument.filters.add("filtroTipoDoc", filtroTipoDoc);

                esqEmpDocument.getEntityCollection(function(result) {

                    if (result.success) {

                        result.collection.collection.items.forEach(this.descargar);

                    }

                }, this);

            },

            

            descargar: function(item) {

                var idDoc = item.values.IdDocumento;

                var nombreDoc = item.values.NombreDocumento;

                //this.showInformationDialog(idDoc);

                var link = "../rest/FileService/GetFile/" + "90e79bf7-1c3e-467b-aaf2-9f8cdb376ce9" + "/" + idDoc;

                

                var file = document.createElement("a");

                file.href = link;

                file.download = nombreDoc;// + ".pdf";

                document.body.appendChild(file);

                file.click();

                document.body.removeChild(file);

            },

Hello, thank you for your answer!

 

I can't see where you pass the parameter to "downloadFile".

 

I don't need to know how to download a file. I want to know how to pass a parameter to a function when I click on a button.

Show all comments