Looking at the documentation, there is no clear way that I see to delete/remove a tab. There are addTab, addCopy, moveTab, etc... but no deleteTab or removeTab or even closeTab.
I need to completely delete a tab. Has anyone seen a way to do this client-side?
Hi, Revbones.
It's seems that the WebTab API don't have such client-side functionality. I suppose there is a reason for this so I will investigate it and will inform you.
Meanwhile I can suggest you workaround for this. You can hide the tabs on the client, those you want to delete, and on the server to check all the hidden tabs and delete them from the tabs collection.
var webTab = $find("<%=WebTab1.ClientID%>"),
tab = webTab.getTabAt(0);
tab.set_hidden(true);
I hope this will help you.
Thanks,Nikolay
Unfortunately hiding tabs won't work for me. I'm loading data via client side templates and feel fairly certain that after a while of creating and hiding tabs that I'll start to run into trouble.
Seriously though? There's not an internal method or something I'm missing? I can't believe Infragistics would have add/delete/move/etc... but not a delete.
In case anyone else gets stuck here. My solution until there is a delete was:
Loop through any extra tabs, set text blank and key = UNUSED, then clear the tab's element's contents and set_hidden(true) on the tab. When creating tabs, I search for a key of 'UNUSED', and if that exists I grab it and moveTab on it to the correct location, set the text and key, and set_hidden(false). if there aren't any, I just create one normally.Would have really been nice to just call deleteTab() or something.
Hi revbones,
The delete tab item on client (or any restructuring of tabs) is not supported because it will be not possible to maintain view states of old tab items. The only supported operation on client is to append (not insert) new tab item. In this situation a special flag is passed from client to server and view states of all existing/old tabs is preserved.The "move" action of tab item is not restructuring, but only changing a VisibleIndex property of a tab.
The restructuring of tabs (real move, insert, delete, etc.) is supported only on server. If application needs to delete tab item, then the easiest way it to hide it on client (and set a specific flag like "UNUSED" and on server find that tab item and remove it.
Below is example:
int count = this.WebTab1.Tabs.Count; while (count-- > 0) { Infragistics.Web.UI.LayoutControls.ContentTabItem tab = this.WebTab1.Tabs[count]; // use condition to remove //if (tab.Text == "Tab 2") //if (tab.Key == "UNSUSED") if (tab.Hidden) { this.WebTab1.Tabs.Remove(tab); } }
Hi V,
I have similar issue. I am creating tabs dynamically and have CLose tab functionality implemented same way you suggested. It is deleting tab from server but when it loads page it gives me JScript error and in ScriptResource.axd file. It looks like it is not resetting indexs on client side. it breaks at this._items[address][0][index].
Also one more thing to note that i am able to close tab without JScript error for first and last index successfully!
Appreciate your help!
Thanks,
Dk
Ok I got it working with the latest Service Release of Infragistics35.Web.v11.2 version Version=11.2.20112.2159,
and also Infragistics35.Web.v12.1 with latest service release Version=12.1.20121.2048.
Hi VK,
I was on vacation and could not reply you earlier. Actually I tried my sample application with Infragistics35.Web.v12.1, Version=12.1.20121.1005 and I am getting exactly same behaviour.
Hi Dk,
I built debug dll for version 11.2.20112.1019 and reproduced exception, which you referred to.
Please, get latest service release for NetAdvantage.
We have license for Infragistic dll 11.2 dll and its version is 11.2.20112.1019.
About AjaxControlToolkit , I was using old version earlier and was facing similar issue. Upgrading to latest version did not help at all.
Thanks for prompt responses,
I cannot give my personal email, maybe there are some other options to down load large attachement. I can consult developer support about that.
I assume that you have latest version of 11.2 dll, which is 11.2.20112.2159 or 11.2.20112.2141. Those versions should be ok. If you have earlier version, then please give me its exact version. (You may look at File version within Details of dll Properties).I could try to find its date in tfs history, gets all files for that date and build debug dll from them. Though, I would like to avoid similar.That is possible that there are other changes in codes of WebTab (besides InstantiateTemplates within OnInit), which make difference for your application.
The best choice is to use the most recent available service release.
To exclude possible issue with version of AjaxControlToolkit, you may replace it in your sample by ScriptManager and check if it makes any difference.