Here the api of tabs plugin :

selected <http://jqueryui.com/demos/tabs/#option-selected>NumberDefault:0

Zero-based index of the tab to be selected on initialization. To set all
tabs to unselected pass -1 as value.
Code examplesInitialize a tabs with the selected option specified.

$( ".selector" ).tabs({ selected: 3 });

Get or set the selected option, after init.

//getter
var selected = $( ".selector" ).tabs( "option", "selected" );
//setter
$( ".selector" ).tabs( "option", "selected", 3 );



I think you only have to pass the actual weekday as a selected value of you
tabs init code...

You can do this like that :

    var actual_day = "{{=actual_weekday_passed_from_web2py_controller}}"



$( ".selector" ).tabs( "option", "selected", actual_day );


I didn't test any thing... But, I guest it should works...

Richard

On Fri, Oct 21, 2011 at 12:51 PM, annet <[email protected]> wrote:

> I am working on a timetable app using jQuery UI tab.
>
>
> This is the timetable view:
>
> <!-- Tabs -->
>  <h2 class="demoHeaders">Lesrooster</h2>
>   <div id="tabs">
>      <ul>
>        <li><a href="{{=URL('classtimes',args=[1])}}">Monday</a></li>
>         <li><a href="{{=URL('classtimes',args=[2])}}">Tuesday</a></
> li>
>         <li><a href="{{=URL('classtimes',args=[3])}}">Wednesday</a></
> li>
>         <li><a href="{{=URL('classtimes',args=[4])}}">Thursday</a></
> li>
>         <li><a href="{{=URL('classtimes',args=[5])}}">Friday</a></li>
>          <li><a href="{{=URL('classtimes',args=[6])}}">Saturday</a></
> li>
>          <li><a href="{{=URL('classtimes',args=[7])}}">Sunday</a></
> li>
>           <li><a href="{{=URL('classtimes',args=['week'])}}">Week</
> a></li>
>         </ul>
>    </div> <!-- tabs -->
>
>
> This the controller:
>
> def timetable():
>    return dict()
>
> def classtimes():
>    if request.args(0)=='week':
>        weekday='all'
>        rows=db(db.lesrooster.bedrijf_id==1).select(db.lesrooster.ALL,
> \
> orderby=db.lesrooster.dag_id|db.lesrooster.tijd)
>    else:
>        weekday=[]
>
>
> rows=db((db.lesrooster.bedrijf_id==1)&(db.lesrooster.dag_id==request.args(0))).select(db.lesrooster.ALL
> \
> ,orderby=db.lesrooster.tijd)
>    return dict(rows=rows)
>
> The classtimes view is a table based view.
>
> This all works, what I don't get to work is the selected tab being
> today's tab, i.e. when today is Friday, Friday's classes should be
> displayed in the Friday tab.
>
> I hope one of you will be able to help me solve this problem.
>
> Kind regards,
>
> Annet

Reply via email to