RadTabStrip (Tabs) reloads when already closed

6 posts, 0 answers
  1. Renan
    Renan avatar
    12 posts
    Member since:
    Jun 2008

    Posted 03 Sep 2008 Link to this post

    I have some problem in RadTabStrip (and its related RadMultiPage)with Q1 and Q2.826 release…

    Here is my situation, my RadTabStrip (Tabs) are loadeddynamically in code behind through the use of Menu (this include PageView inRadMultiPage) and it works perfectly, then I add close button for each Tab inClient Side, no problem with this and it works perfect too…

    Partial code for Delete Tab:

    For close button:

            functiondeleteTab(tabText)

            {

            vartabStrip = $find("<%= RadTabStrip.ClientID%>");

            varmultiPage = $find("<%= RadMultiPage.ClientID%>");

            var tab =tabStrip.findTabByText(tabText.get_text());

            varpageView = tab.get_pageView();

            vartabToSelect = tab.get_nextTab();

               if(!tabToSelect)

                   tabToSelect = tab.get_previousTab();

               tabStrip.get_tabs().remove(tab);

               multiPage.get_pageViews().remove(pageView);

               if(tabToSelect)

                    tabToSelect.set_selected(true);          

            }

    The close button for each Tab are working perfectly, itdeletes Tab and removes the corresponding PageView, please note that my tabsare multiple they can go from 1 to 10 tabs…

    The problem is, let say I have 4 opened tabs (tab1, tab2,tab3 and tab4) and I close the tab2, tab3 and tab4 and only tab1 remains open(they will close perfectly) but then when I reopen tab4 “only” the tab2 andtab3 “or other previous close tabs” will reopen/reload also.

    Is there any ways to correct this problem or prevent forreopening/reloading the already closed Tab and its corresponding PageView?

     

    Thanks in advance!

  2. Shawn Currie
    Shawn Currie avatar
    11 posts
    Member since:
    Jul 2009

    Posted 29 Sep 2009 Link to this post

    Did you ever find the fix for your issue?
  3. Renan
    Renan avatar
    12 posts
    Member since:
    Jun 2008

    Posted 29 Sep 2009 Link to this post

    Hi Shawn,

     

     

    Yes, I fixed it… however if you will ask me how, then, I’ll tell you that I need to review my code because it’s been Nth month since I posted this concern and no one was able to help me, by the way, we are now shifting to jQuery and jQuery UI.

  4. Shawn Currie
    Shawn Currie avatar
    11 posts
    Member since:
    Jul 2009

    Posted 30 Sep 2009 Link to this post

    Hi Renan! I'm having a similar issue you had and was hoping you might be able to share your solution. No worries if you can't post your solution.

    Thanks!
    Shawn
  5. Renan
    Renan avatar
    12 posts
    Member since:
    Jun 2008

    Posted 30 Sep 2009 Link to this post

    Hi Shawn,

     

    Check this JavaScript, pay attention on *tab* function specially on delete and the attachment of delete image to control the removal of tab.

     

    I want to extend my help but currently we are so! so! busy at the moment, I hope you can find some answer from this script.

     

     

        <div id="DivScript" runat="server">  
     
            <script type="text/javascript">   
                      
                    /* Resize RadPanelBar when browser resize */ 
                    //window.onresize = OnRadPanelResize;  
                      
                    /* close all windows if the web panel is closed */ 
                    function closeAllWindows(oWnd)  
                    {                                         
                        var oManager = GetRadWindowManager();  
                        oManager.closeAll();  
                    }        
     
                    /* Prevent Menu PostBack when clicked Item Value is Null. */ 
                    function OnMenuItemClicking(sender, eventArgs)  
                    {  
                      var item = eventArgs.get_item();  
                      var text = item.get_text();  
                      var navigateUrl = item.get_value();  
     
                      if (text == "Logout")  
                      {  
                            var msg = confirm("Are you sure you want to Log Out eQuotes System?");  
                            if (!msg){  
                                eventArgs.set_cancel(true);  
                            }else{  
                                eventArgs.set_cancel(false);  
                            }  
                            return;  
                      }  
     
                      if (navigateUrl == null || navigateUrl == "")  
                      {  
                            eventArgs.set_cancel(true);  
                      }  
                      else 
                      {  
                            var bReturn = IsTabLoaded(text);  
                            if (bReturn)  
                            {  
                                eventArgs.set_cancel(true);  
                            }  
                      }  
                        
                    }  
     
                   /* Check if selected menu is already loaded from our Tab */ 
                   function IsTabLoaded( strTabText )  
                   {                 
                       var multiPage = $find("<%= RadMultiPage.ClientID %>");  
                       var myTab = $find('<%= RadTabStrip.ClientID %>');  
                         
                       if (myTabStrip.get_tabs().get_count() >= 4)  
                       {  
                            alert("Please be advised that you are only allowed to open not more than 3 product tabs simultaneously.");  
                            return true;  
                       }  
                         
                       for (var i = 0; i < myTabStrip.get_tabs().get_count(); i++)  
                       {  
                            if (strTabText == myTabStrip.get_tabs().getItem(i).get_text())  
                            {  
                                myTabStrip.get_tabs().getItem(i).set_selected(true);  
                                return true;  
                            }  
                       }  
                       return false;  
                   }  
     
     
                    function OnClientTabSelecting(sender, args)   
                    {   
                        if (args.get_tab().get_pageView())   
                        {   
                            if(args.get_tab().get_pageView().get_id())   
                            {   
                                args.get_tab().set_postBack(false);   
                            }   
                        }   
                    }   
     
                    function OnClientTabSelected(sender, args)   
                    {  
                        if (args._tab.get_text() == "Home")  
                        {  
                            document.getElementById('IFrameContainer').contentWindow.RebindGrid();   
                        }  
                    }  
     
                   /* -------------------------------- */ 
                   /* Create closable tabs client-side */ 
                   /* -------------------------------- */ 
                   var myTabStrip;  
                     
                   function OnClientLoad()  
                   {  
                       myTabStrip = $find('<%= RadTabStrip.ClientID %>');  
                         
                       for (var i = 1; i < myTabStrip.get_tabs().get_count(); i++)  
                       {  
                           AttachCloseImage(myTabStrip.get_tabs().getItem(i), "Images/Menu/tabClose.gif");  
                       }  
                   }  
                                    
                   function CreateCloseImage(closeImageUrl)  
                   {  
                       var closeImage = document.createElement("img");  
                       closeImage.src = closeImageUrl;  
                       closeImage.alt = "Close this tab";  
                       return closeImage;  
                   }  
                             
                   function AttachCloseImage(tab, closeImageUrl)  
                   {  
                       var closeImage = CreateCloseImage(closeImageUrl);  
                       closeImage.AssociatedTab = tab;  
                       closeImage.onclick = function(e)  
                       {  
                           if (!e) e = event;  
                           if (!e.target) e = e.srcElement;  
                             
                           deleteTab(tab);  
                             
                           e.cancelBubble = true;  
                           if (e.stopPropagation)  
                           {  
                              e.stopPropagation();  
                           }  
                             
                           return false;  
                       }  
                       tab.get_innerWrapElement().appendChild(closeImage);  
                   }  
                     
                   function deleteTab(tabText)  
                   {  
                       var tabStrip = $find("<%= RadTabStrip.ClientID %>");  
                       tabStrip.trackChanges(); //tack change for server submit  
     
                       var multiPage = $find("<%= RadMultiPage.ClientID %>");  
                       multiPage.trackChanges();//tack change for server submit  
                         
                       var tab = tabStrip.findTabByText(tabText.get_text());  
                       var pageView = tab.get_pageView();  
     
                       var tabToSelect = tab.get_nextTab();  
                       if (!tabToSelect)  
                           tabToSelect = tab.get_previousTab();  
                          
                       tabStrip.get_tabs().remove(tab);  
                       multiPage.get_pageViews().remove(pageView);  
     
                       if (tabToSelect)  
                            tabToSelect.set_selected(true);        
                         
                       multiPage.commitChanges();//submit to server all changes  
                       tabStrip.commitChanges(); //submit to server all changes     
                         
                       document.getElementById('IFrameContainer').contentWindow.RebindGrid();    
                   }  
                   /* ---------------END-------------- */ 
     
                    //<!--             
     
                    /* oc Object Converter */                  
                    function oc(arr)  
                    {  
                        var obj = {};  
                        for(var i=0;i<arr.length;i++)  
                        {  
                            obj[arr[i]]='';  
                        }  
                        return obj;  
                    }                    
     
                    var blnDragging = false;  
     
                    function OnClientItemClicking(sender, eventArgs)  
                    {  
                        var multipage=$find("RadMultiPageNavigation");  
                        multipage.set_selectedIndex(eventArgs.get_item().get_index());  
                    }  
     
                    function OnClientNodeClicking(sender, eventArgs)  
                    {  
                        var nodeValue = eventArgs._node.get_value();  
                        var nodeText = eventArgs._node.get_text();  
     
                        if( nodeText in oc(['Change Agent Name','Change Password','Contents''Support Info']) )  
                        {                         
                            return;  
                        }  
     
                        if (nodeValue == "Root")  
                        {  
                            eventArgs.set_cancel(true);  
                        }  
                        else 
                        {  
                            var bReturn =IsTabLoaded(nodeText);  
                            if (bReturn)  
                            {  
                                eventArgs.set_cancel(true);  
                            }  
                        }  
                    }   
     
                    function doPostBackHiddenField()  
                    {  
                       var hFld = document.getElementById('SelectedRecentQuoteID');  
                       if (hFld.value == 'undefined' || hFld.value == '0'return;  
                        __doPostBack(hFld.id,'');  
                    }  
     
                    function doPostBackHiddenField2()  
                    {  
                       var hFld = document.getElementById('SelectedRecentTradQuoteID');  
                       if (hFld.value == 'undefined' || hFld.value == '0'return;  
                        __doPostBack(hFld.id,'');  
                    }  
                      
                    function ResetSelectedRepoProposalID()  
                    {  
                       var hFld = document.getElementById('SelectedRecentQuoteID');  
                       if (hFld.value == 'undefined' || hFld.value == '0'return;  
                       hFld.value = '0';  
     
                       var hFld = document.getElementById('SelectedRecentTradQuoteID');  
                       if (hFld.value == 'undefined' || hFld.value == '0'return;  
                       hFld.value = '0';  
                    }  
     
                    function CallRebindRecentQuotes()  
                    {  
                        //document.getElementById('ifrm').contentWindow.RebindGrid();  
                        document.getElementById('IFrameContainer').contentWindow.RebindGrid();  
                    }  
                      
                    function doPostBackhfSessionTimeOut()  
                    {  
                       var hFld = document.getElementById('hfSessionTimeOut');  
                       if (hFld.value == 'undefined' || hFld.value == '0'return;  
                        __doPostBack(hFld.id,'');  
                    }  
                    //-->            
            </script>  
     
        </div> 

    /r

  6. Shawn Currie
    Shawn Currie avatar
    11 posts
    Member since:
    Jul 2009

    Posted 02 Oct 2009 Link to this post

    Hi Renan! Thanks for the info. After some very carefull code reviewing I figured out my issue. It works just as a need it to work.

    Thanks Again!
Back to Top