(SOLVED) How to add 2 or more buttons in page ?

 

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