Add a RemoveTab method that only removes the tab at the index specified

Hi,

Would you please add a method like RemoveTab that only removes the tab at the specified index, not from the specified index and every other tab after that.

Nick

3 Replies

AK Alagumeena Kalaiselvan Syncfusion Team March 4, 2020 12:21 PM UTC

Hi Nick, 

Greetings from Syncfusion support! 

We have validated your reported query and currently it is not feasible to achieve your case with public method of Tab. Meanwhile, you can achieve this same scenario by using RemoveTab method of Tab. 
We have prepared a sample based on your requirement and refer the below code for that 

@using Syncfusion.EJ2.Blazor.Navigations 
 
<button @onclick="ClickToRemoveTab">Remove Tab</button> 
<br/> 
 
<EjsTab @ref="TabObj"> 
    <TabItems> 
        <TabItem Content="Hypertext Markup Language, commonly referred to as HTML, is the standard markup language used to create webpages."> 
            <ChildContent> 
                <TabHeader Text="HTML"></TabHeader> 
            </ChildContent> 
        </TabItem> 
        <TabItem Content="C# is intended to be a simple, modern, general-purpose, object-oriented programming language."> 
            <ChildContent> 
                <TabHeader Text="C Sharp(C#)"></TabHeader> 
            </ChildContent> 
        </TabItem> 
        <TabItem Content="Java is a set of computer software and specifications developed by Sun Microsystems, later acquired by OracleCorporation, that provides a system for developing application software and deploying it in a cross - platform computing environment."> 
            <ChildContent> 
                <TabHeader Text="Java"></TabHeader> 
            </ChildContent> 
        </TabItem> 
        <TabItem Content="The command-line compiler, VBC.EXE, is installed as part of the freeware .NET Framework SDK."> 
            <ChildContent> 
                <TabHeader Text="VB.Net"></TabHeader> 
            </ChildContent> 
        </TabItem> 
        <TabItem Content="Xamarin is a San Francisco, California based software company created in May 2011 by the engineers that created Mono, Monofor Android and MonoTouch that are cross-platform implementations of the Common Language Infrastructure (CLI) and Common Language Specifications (often called Microsoft .NET). With a C#-shared codebase, developers can use Xamarin tools to write native Android, iOS, and Windows apps with native user interfaces and share code across multiple platforms."> 
            <ChildContent> 
                <TabHeader Text="Xamarin"></TabHeader> 
            </ChildContent> 
        </TabItem> 
        <TabItem Content="ASP.NET is an open-source server-side web application framework designed for web development to produce dynamic web pages."> 
            <ChildContent> 
                <TabHeader Text="ASP.NET"></TabHeader> 
            </ChildContent> 
        </TabItem> 
        <TabItem Content="The ASP.NET MVC is a web application framework developed by Microsoft, which implements the model–view–controller(MVC) pattern. It is open - source software, apart from the ASP.NET Web Forms component which is proprietary."> 
            <ChildContent> 
                <TabHeader Text="ASP.NET MVC"></TabHeader> 
            </ChildContent> 
        </TabItem> 
    </TabItems> 
</EjsTab> 
 
@code{ 
    EjsTab TabObj; 
    public void ClickToRemoveTab() 
    { 
        var removeStart = 2; // Define the tab index from where you begin to remove tab items 
        var removedItemsCount = TabObj.Items.Count ; 
        for (var i = removeStart; i < removedItemsCount; i++) 
        { 
            TabObj.RemoveTab(TabObj.Items.Count-1); // To Remove the tab items 
        } 
    } 
} 
  
  • In above sample, the  specified tab item has been removed and every other tabs after that.

Also you can download this sample using the following link 

Kindly try out with shared sample and get back to us, If you need further assistance 

Regards 
Alagumeena .K 



XA Xavier March 28, 2022 03:32 PM UTC

Hi. I think there is a misunderstood here.

The problem that Nick (and also me) are having is that, when you Remove a tab with RemoveTab method, (passing an index) it removes NOT only that tab, but all the following ones.


The method RemoveTab should only remove the specified Tab. Isn't that a bug?


Thank you Alagumeena.




SK Satheesh Kumar Balasubramanian Syncfusion Team March 29, 2022 01:21 PM UTC

Hi Xavier,

 

You can use RemoveTab public method to remove the specified tab.

 

 

Kindly try the above links and let us know further assistance.

 

Regards,​

Satheesh Kumar B


Loader.
Up arrow icon