You seem to be using a fairly outdated version of Tabs. I may have
fixed the bug in the meantime already.

--Klaus




On 16 Jan., 23:41, "Russ Hacker" <[email protected]> wrote:
> Klaus,
>
> I posed this response to another thread, but it does not appear to be
> logging, so I'm trying a post via email.
>
> ******************************************
> ******************************************
>
> Klaus,
>
> Thanks for the assistance on another thread...thought I would add to this
> thread as I have found that I CAN replicate the non-indexing bug and have
> attempted to work-around it before I found this thread.  Here is the demo:
>
> http://radsrc.fastcheapweb.com/siteignite/poppage
>
> The initial tabs load behaves as one would expect.  The alert boxes indicate
> the tab events that are fired.  BTW, the URLs are dynamically generated and
> refreshed and work great in the initial load.
>
> Here's how to gen problems:
>
> 1.  Select "Home" from the "Templates" dropdown.
> 2.  Select "Careers" from the "Pages" dropdown (actually select anything you
> wish)
>
> Here's what happens when you do that:
> 1.  An ajax form returns the list divs for new tabs that appears in
> #NewTabs.  I started down this kludgy path because if I set the ajax target
> to the tabs container I could never get the tabs to refresh.  Instead I
> "remove" the "old" tabs and "add" new tabs that appear as a list of divs in
> #NewTabs.
> 2.  When the new tabs are returned, the function readyTabs() is called.
> This function:
>   (a)  Gets the Initial count of the tabs present
>   (b)  Adds the "new" tabs
>   (c)  Deletes all but one of the "old" tabs
>
> The portion that is germane to this thread is that I found that I had to
> delete BACKWARD decrementing:
>     var delCount = initCount-1;
>     while(delCount!=0){
>         window.$tabsPara=window.$tabsPara.tabs( "remove",  delCount);
>         delCount=delCount-1;
>     }
>
> ...as opposed to simply iterating through using:
>        window.$tabsPara.tabs( "remove",  0);
>
> If you try and remove the tabs that way--or by incrementing [ ( "remove",
> 0), ( "remove",  1), ( "remove",  2)...]--then it will fail because the tabs
> don't get re-indexed faster than the deleting loop.
>
> Other things that I found were:
>
> *   If you delete all of the tabs before adding new ones, the panel
> disappears.
> *   Options "tabTemplate" seems to work, but "panelTemplate" does not.  I
> have tried numerous variations from simple "<div></div>" to fully-generated
> "<div style='' class='ui-tabs-panel' id='CurrentContent'></div>".
>
> My "work-around" was to generate a blank tab at initialization, disable that
> tab, and then never delete this associated tab and panel.  This seemed to
> preserve the panel while I deleted the initial tabs.
>
> Okay, now the problem that I have now:  After the new tabs are created,
> their events stop firing (see "gen problems" above).  I thought maybe it was
> because the tabs() calls were not refreshing the object, so the last thing
> that I tried was always returning that result back into the object using
> "window.$tabsPara=", but it while the tab control _appears_ to be
> "selecting...loading...focusing'' none of the events are being fired.
>
> Here is the relevant code:
>
> window.CurrentPanel = "";
> window.$tabsPara = $("#si > ul").tabs({
>         selected: null,
>         remote: true ,
>         spinner: 'Please wait...',
>         tabTemplate:"<li><a href='#{href}'  
> title='CurrentContent'><span>#{label}</span></a></li>",
>
>         panelTemplate: "<div style='' class='ui-tabs-panel'
> id='CurrentContent'></div>",
>         disabled: [0],
>     select: function(e, ui) {
>         alert('select');
>
>         // update global for editor synch AND AJAX call
>             // try this for speed increase
>             //find(":nth-child(1)")
>         CurrentPanel =$(ui.tab).children(":first-child").html();
>
>         //  make URL
>         var ajxURL=CurrentURL
>             +'/ajx_crud/'
>             +CurrentPanel
>             +'/'+$('#selectTemplates').val()
>             +'/'+$('#selectPages').val()
>             +'/R';  // crud parameter--'read'
>             // trim spaces
>             ajxURL = $.string(ajxURL).strip().str;
>
>             // clear / re-set editor
>             var html ="<p>";
>             $.fck.setHTML('textarea1', html);
>
> //        alert('SELECT ui.index--'+ui.index)
>
>             // refresh URL
>             window.$tabsPara.tabs( "url", ui.index, ajxURL);
>
>         return true;
>     },
>     load: function(ui) {
>         alert('load');
>
>             // ajax load if nothing is peending
>         var pendingTab='#pend'+window.CurrentPanel;
>         var pendHTML = $(pendingTab).val();
>
>             if (pendHTML != "unset") {
>                 $('#CurrentContent').html(pendHTML);
>                 return false;
>             }
>             else {
>                 return true;
>             }
>         },
>     show: function(ui) {
>         alert('show');
>
>         // container that has "current" db value
>         var currentDB='#init'+window.CurrentPanel;
>         if($(currentDB).val()=="unset"){
>             $(currentDB).val($('#CurrentContent').html());
>         };
>
>         return true;
>     },
>     add: function(e,ui) {
>         alert('add');
>         CurrentPanel =$(ui.tab).children(":first-child").html();
>             var ajxURL=CurrentURL
>                 +'/ajx_crud/'
>                 +CurrentPanel
>                 +'/'+$('#selectTemplates').val()
>                 +'/'+$('#selectPages').val()
>                 +'/R';  // crud parameter--'read'
>                 // trim spaces
>                 ajxURL = $.string(ajxURL).strip().str;
>             window.$tabsPara.tabs( "url", ui.index, ajxURL )
>         return true;
>     }
>
> });
>
> function readyTabs(){
>
>     // get the starting number of tabs
>     var initCount = window.$tabsPara.tabs("length");
>
>     // add new tabs
>     $("#NewTabs > div").each(function(i){
>             var label = $(this).text();
>             // alert(label);
>             window.$tabsPara=window.$tabsPara.tabs( "add", label,  label);
>     });
>
>     // initCount is the number of tabs, but array is 0-based
>     var delCount = initCount-1;
>     while(delCount!=0){
>         window.$tabsPara=window.$tabsPara.tabs( "remove",  delCount);
>         delCount=delCount-1;
>     }
>
>     //  now select first tab so that CurrentPanel has a default value set
>     window.$tabsPara=window.$tabsPara.tabs( "select", 1);
>
>     //  reset init and post textareas
>         readyReset();
>
>     iconStates(CurrentPanel);
>
>     // DEBUG ONLY
>     //  alert('here'+$(this).val());
>
> }
>
> Of course, feel free to view source 
> athttp://radsrc.fastcheapweb.com/siteignite/poppage
>
> Sorry for the long post...again.
>
> Russ
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery UI" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/jquery-ui?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to