HI,

I have tabs and in one one of them I have a SQLFORM.grid displayed.
But when i hit say view or search the grid, the default tabs is
displayed. Is there a way of making SQLFORM.grid make ajax calls
instead of refreshing whole page...or is there another way i can
ensure my grid refreshes the same tab on which is is displayed...here
is my code:

Control:

def index():
    response.subtitle = "Human Resource and Administration"
    db.department.id.readable = False
    headers = {'db.department.name': 'Department
Name','db.department.description': 'Description'}
    default_sort_order=[db.department.name]
    form = SQLFORM.grid(db.department, headers=headers,
orderby=default_sort_order, create=False, deletable=False,
editable=False, maxtextlength=64, paginate=25)
    return dict(form=form)

Views - index.html:

{{extend 'layout.html'}}
<div class="tabbable"> <!-- Only required for left/right tabs -->
  <ul class="nav nav-tabs">
    <li class="active"><a href="#tab1" data-toggle="tab">Section 1</a></li>
    <li><a href="#tab2" data-toggle="tab">Section 2</a></li>
    <li class="dropdown">
        <a class="dropdown-toggle"
           data-toggle="dropdown"
           href="#">
            Meta Data
        </a>
        <ul class="dropdown-menu">
                <li><a href="#tab3" id="department" tabindex="-1"
data-toggle="tab">Manage Departments</a></li>
                <li><a href="#tab3" id="office" tabindex="-1"
data-toggle="tab">Manage Office Titles</a></li>
            <li class="divider"></li>
            <li><a href="#tab3" tabindex="-1" data-toggle="tab">Manage
List</a></li>
        </ul>
        </li>
  </ul>
  <div class="tab-content">
    <div class="tab-pane active" id="tab1">
      <p>I'm in Section 1.</p>
    </div>
    <div class="tab-pane" id="tab2">
      <p>Howdy, I'm in Section 2.</p>
    </div>
    <div class="tab-pane" id="tab3">
        <div id="department_form">{{include 'administration/test.html'}}</div>
    </div>
  </div>
</div>
<script>
        jQuery('#department_form').hide();
    jQuery('#department').click(function(){
        jQuery('#department_form').show('fade');
    });
</script>

View: test.html

<!--Navigation Bar-->
<div class="navbar">
  <div class="navbar-inner">
    <a class="brand" href="#">Manage Department Data</a>
    <ul class="nav">
      <li class="active"><a href="#">Add New</a></li>
      <li><a href="#">Edit</a></li>
      <li class="divider-vertical"></li>
    </ul>

    <form class="navbar-form pull-left">
         <input type="text" class="span2" placeholder="search">
         <button type="submit" class="btn">Search</button>
        </form>
  </div>
</div>
<!--Nav End -->
<!--Grid-->
{{=form}}
-- 
.......................................................................................
Teddy Lubasi Nyambe
Opensource Zambia
Lusaka, ZAMBIA

Cell: +260 97 7760473
website: http://www.opensource.org.zm

~/
Human Knowledge belongs to the world! - AntiTrust

Man is a tool-using animal. Without tools he is nothing, with tools he
is all - Thomas Carlyle 1795-1881

/~

-- 



Reply via email to