Maybe something like:

{{show_tab = None}}
<div class="tab-content">
{{for i, tab in enumerate(['lesrooster', 'event_list', 'cursusrooster']):}}
  {{if session.cal[tab]:}}
    {{this_tab = 'tab-%s' % i}} {{show_tab = this_tab if not show_tab 
elseshow_tab
}}
    <div class="tab-pane" id="{{=this_tab}}">
    </div> <!-- /tab-pane -->
  {{pass}}
{{pass}}
</div> <!-- /tab-content -->

{{if show_tab:}}
<script type="text/javascript">
$(document).ready(function(){
  $('a[href=#{{=show_tab}}]').tab('show');
});
</script>
{{pass}}

Anthony

On Wednesday, July 4, 2012 4:36:37 AM UTC-4, Annet wrote:
>
> Hi Anthony,
>
> I would expect the ajaxSuccess handler to fire after each of the three 
>> Ajax calls. Have you confirmed whether it is firing (e.g., maybe add an 
>> alert to it to see if a message pops up)?
>
>
> There were no Ajax calls at all. After adjusting calendar.html:
>
> <script type="text/javascript">
> $(document).ready(function(){
>   $('a[href=#{{=tab}}]').tab('show');
> });
> </script>
>
> <ul class="nav nav-tabs">
>   {{if session.cal.lesrooster:}}
>     <li><a data-toggle="tab" href="#tab-1" 
> onclick={{="web2py_component('%s','tab-1')" %URL('site','classes.load',args=
> session.id)}}>Lessen</a></li>
>   {{pass}}
>   {{if session.cal.event_list:}}
>     <li><a data-toggle="tab" href="#tab-2" 
> onclick={{="web2py_component('%s','tab-2')" %URL('site','events.load',args=
> session.id)}}>Events</a></li>
>   {{pass}}
>   {{session.cal.cursusrooster}}
>     <li><a data-toggle="tab" href="#tab-3" 
> onclick={{="web2py_component('%s','tab-3')" %URL('site','courses.load',args=
> session.id)}}>Cursussen</a></li>
>   {{pass}}
> </ul>
>  
> <div class="tab-content">
>   {{if session.cal.lesrooster:}}
>     <div class="tab-pane" id="tab-1">
>     </div> <!-- /tab-pane -->
>   {{pass}}
>   {{if session.cal.event_list:}}
>     <div class="tab-pane" id="tab-2">
>     </div> <!-- /tab-pane -->
>   {{pass}}
>   {{if session.cal.cursusrooster:}}
>     <div class="tab-pane" id="tab-3">
>     </div> <!-- /tab-pane -->
>   {{pass}}
> </div> <!-- /tab-content -->
>
>
>  I do have Ajax calls the only problem is that this script: 
>
>
> <script type="text/javascript">
> $(document).ready(function(){
>   $('a[href=#{{=tab}}]').tab('show');
> });
> </script>
>
>
> Initially the tab-pane is empty, only after clicking one of the tabs the 
> content loads. Which contents loads initially depends on whether there are 
> classes, events and courses, so adding this to the tab-1 is no option:  
> {{=LOAD('site','classes.load',args=session.id,ajax=True,target='tab-1')}}. 
> Do you know how to solve this problem?
>
>
> Kind regards,
>
> Annet.
>

Reply via email to