Unplanned
Last Updated: 16 Mar 2023 14:21 by ADMIN
Besir
Created on: 14 Mar 2023 09:12
Category: TabStrip
Type: Feature Request
7
Closeable tabs

Hello

Many times when removing a TabItem manually, we need to update some parameter or trigger some event. I think this is a missing feature for the TabStrip Component and should be added as soon as possible. I made a Custom Version of the TabStrip and added this functionality (see the unrelined Lines below):

In TelerikTabStrip.razor.cs

        /// <summary>
        /// Fires when a tab has been removed.
        /// </summary>
        [Parameter]
        public EventCallback<int> TabRemoved { get; set; } 

 

void ITabContainer.RemoveTab(ICustomTab tab)
        {
  int tabIndex = Tabs.IndexOf(tab);
            if (PersistTabContent)
            {
                PersistedTabs.Remove(tab);
            }

            Tabs.Remove(tab);

  if (TabRemoved.HasDelegate)
                TabRemoved.InvokeAsync(tabIndex);


        }

 

This way we can handle the event of removing the TabItems manually and trigger additional actions.

What also could help is triggering the ActiveTabIndexChanged whenever a new TabItem is added or removed.

 

Thanks

BR

Besir

                   
2 comments
ADMIN
Svetoslav Dimitrov
Posted on: 16 Mar 2023 14:21

Hello Besir,

I have renamed the feature request for a built-in feature for closable tabs in the TabStrip as a built-in feature. This feature might include the OnTabClosed event (or an event with a similar signature). 

Regards,
Svetoslav Dimitrov
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Besir
Posted on: 14 Mar 2023 09:25
Additional Info/Correction: altough I mention removing the TabItem manually (which is not the real issue), the problem is especially when removing the TabItems programmatically, ex. in a wizard page. There should be a possibility to catch these events (add/remove) or at least to trigger the ActiveTabIndexChanged event when adding/removing TabItem (either manually or programmatically)