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

Cancel on beforeActive

Hi,

i  have a multitab with three tabs. When i click on second tab i would to remain on previous tab. 
If i set true or "cancel" param, the multitab does not show nothing.
It's the right method? My need is to block the user on the active tab programmatically.

tab

<script type="text/javascript">
 
    $(document).ready(function () {
 
        $("#tab").ejTab({
            width: "300px",
            beforeActive: function (args) {
                if (args.activeIndex == 1) args.cancel = true;
            }
        });
 
    });
 
</script>
<div id="tab">
    <ul>
        <li><a rel='nofollow' href="#javaScript">JavaScript</a></li>
        <li><a rel='nofollow' href="#cSharp">C Sharp (C#)</a></li>
        <li><a rel='nofollow' href="#vb">VB.Net</a></li>
    </ul>
    <div id="javaScript">
        JavaScript (JS) is an interpreted computer programming language.
        It was originally implemented as part of web browsers so that client-side scripts could interact with the user, control the browser, communicate asynchronously, and alter the document content that was displayed. More recently, however, it has become common in both game development and the creation of desktop applications.
    </div>
    <div id="cSharp">
        C# is intended to be a simple, modern, general-purpose, object-oriented programming language. Its development team is led by Anders Hejlsberg. The most recent version is C# 5.0, which was released on August 15, 2012.
    </div>
    <div id="vb">
        The command-line compiler, VBC.EXE, is installed as part of the freeware .NET Framework SDK. Mono also includes a command-line VB.NET compiler. The most recent version is VB 2012, which was released on August 15, 2012.
    </div>
</div>

Thanks

Stefano


Attachment: TabChange_8433e6db.zip

3 Replies

SN Sasikala Nagarajan Syncfusion Team February 2, 2015 01:00 PM UTC

Hi Stefano,

We considered this requirement “args.cancel==true should block the opening the new tab and also it’s should be remains in previous tab” as bug and a support incident has been created under your account to track the status of this requirement. Please log on to our support website to check for further updates.

https://www.syncfusion.com/account/login?ReturnUrl=/support/directtrac/incidents

For your convenience we have prepared the work around solution to achieve your requirement. Please use below code snippet to achieve your reported requirement

[_Script]

<script>

    var tabObj;

    $(document).ready(function () {

        $("#tab").ejTab({

            width: "300px",

            beforeActive: onBeforeActive,

        });

        tabObj = $("#tab").data("ejTab");

    });

    function onBeforeActive(e) {

        if (e.activeIndex == 1) {

            e.cancel = true;

            tabObj.showItem(e.prevActiveIndex);

        }

    }

 </script>

Regards,

Sasikala Nagarajan




SE Stefano Enrico February 2, 2015 02:57 PM UTC

Hi Sasikala Nagarajan,

thanks for the work around solution.

Stefano


SN Sasikala Nagarajan Syncfusion Team February 4, 2015 03:34 AM UTC

Hi Stefano,
Thanks for the update

Please let us know if you have further queries,

Regards,

Sasikala Nagarajan



Loader.
Live Chat Icon For mobile
Up arrow icon