We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Add controls at runtime

Hello:

I want to add tabs at runtime in a JavaScrpit Ribbon. I know that I can create at start and Hide and show, but I need to créate after the ribbon has been created.

Is there any way to do it?

Thanks for your time!

Juan Segura

3 Replies

KN Kavitha Narayanan Syncfusion Team October 26, 2015 07:04 AM UTC

Hi Juan Segura,

Thanks for using Syncfusion products.

Query: I want to add tabs at runtime in a JavaScrpit Ribbon. I know that I can create at start and Hide and show, but I need to créate after the ribbon has been created.

We use addTab() method to add tab at runtime in the ribbon control in which new tab will be added while clicking the button.

[Code]

<div id="Ribbon"></div>
<input type="button" value="Click to add new Tab" id="btn" onclick="btnclick(this)">

<Script>

$(function () {

            $("#Ribbon").ejRibbon({

                // Set the width during initialization.        

                width: "700px"

            });
        });

function btnclick(e)

        {

            var tabGroup = [{

                text: "New1", alignType: ej.Ribbon.alignType.rows, content: [{

                    groups: [{ //display in ribbon tab

                        id: "new1",

                        text: "New Tab2",

                    }

                    ],

                    defaults: {

                        type: ej.Ribbon.type.button,

                        width: 60,

                        height: 70

                    }

                }]

            }];

            var ribbonObj = $("#Ribbon").data("ejRibbon");

            ribbonObj.addTab("Tab2", tabGroup, 2);//New tab will be added while clicking the button
        }

For your reference, we have attached a sample and UG link.

Sample: http://www.syncfusion.com/downloads/support/forum/120889/ze/Sample1177970511.zip
UG Link: http://help.syncfusion.com/js/api/ejribbon#methods:addtab

Regards,
Kavitha N.





ST Soporte Turyser October 27, 2015 10:48 PM UTC

Great!

Thanks for your help!


KN Kavitha Narayanan Syncfusion Team October 29, 2015 05:12 AM UTC

Hi Soporte.

Please let us know if you have any other query.

Regards,
Kavitha N.


Loader.
Live Chat Icon For mobile
Up arrow icon