无法使用flexigrid在Jquery工具选项卡中工作

时间:2010-02-20 22:06:52

标签: jquery jquery-ui-tabs flexigrid

我对jquery和Im使用jquery tools for tabs相当新。我想在其中一个标签中显示flexigrid,但是当我尝试这样做时,flexigrid没有出现,它只是空白。如果我在选项卡外的独立页面中设置flexigrid,它可以正常工作。下面是不起作用的代码。再次,我是新的,请放轻松!

    <ul class="css-tabs">
      <li><a href="#details">Account Details</a></li>
      <li><a href="#accounts">Sub Accounts</a></li>
      <li><a href="#groups">Groups</a></li>
      <li><a href="#support">Tickets</a></li>
    </ul>

    <div class="css-panes">
      <div>Tab 1</div>
      <div><table id="flex1" style="display:none"></table></div>
      <div>Tab 3</div>
      <div>Tab 4</div>
    </div>

     <script>
$(function() {
$("ul.css-tabs").tabs("div.css-panes > div").history();
});

$('.flexme1').flexigrid();
$('.flexme2').flexigrid({height:'auto',striped:false});

$("#flex1").flexigrid
(
{
url: '/accounts_list.php',
dataType: 'json',
colModel : [
{display: 'ID', name : 'id', width : 45, sortable : true, align: 'center'},
{display: 'Username', name : 'username', width : 120, sortable : true, align: 'left'},
{display: 'Display Name', name : 'displayname', width : 150, sortable : true, align: 'left'},
{display: 'Limit', name : 'accounts', width : 50, sortable : true, align: 'center'},
{display: 'Rate', name : 'charge', width : 50, sortable : true, align: 'center'},
{display: 'Subs', name : 'subcount', width : 50, sortable : true, align: 'center'}
],
searchitems : [
{display: 'ID', name : 'id'},
{display: 'Username', name : 'username', isdefault: true},
{display: 'Display Name', name : 'displayname'}
],
sortname: "id",
sortorder: "desc",
usepager: true,
singleSelect: true,
title: 'Test',
useRp: true,
rp: 20,
showTableToggleBtn: false,
width: 500,
height: 250
});
     </script>

1 个答案:

答案 0 :(得分:0)

使用它们时我没有遇到任何麻烦。

<!-- Here are the tabs -->
<ul class="css-tabs">
  <li><a href="#details">Account Details</a></li>
  <li><a href="#accounts">Sub Accounts</a></li>
  <li><a href="#groups">Groups</a></li>
  <li><a href="#support">Tickets</a></li>
</ul>

<!-- Here is the tab's content -->
<div class="css-tabs">
  <div>Tab 1</div>
  <div><table id="flex1" style="display:none"></table></div>
  <div>Tab 3</div>
  <div>Tab 4</div>
</div>

<script type="text/javascript">
   // On DOM ready,
   $(function() {
      // Setup the tabs.
      $("ul.css-tabs").tabs("div.css-panes > div").history(); 

      //Setup the Table
      $("#flex1").flexigrid({
         // Make sure, you are pointing to the right page. NO 404.
         url: '/accounts_list.php',
         dataType: 'json',
         colModel : [
           {display: 'ID', name : 'id', width : 45, sortable : true, align: 'center'},
           {display: 'Username', name : 'username', width : 120, sortable : true, align: 'left'},
           {display: 'Display Name', name : 'displayname', width : 150, sortable : true, align: 'left'},
           {display: 'Limit', name : 'accounts', width : 50, sortable : true, align: 'center'},
           {display: 'Rate', name : 'charge', width : 50, sortable : true, align: 'center'},
           {display: 'Subs', name : 'subcount', width : 50, sortable : true, align: 'center'}
         ],
         searchitems : [
           {display: 'ID', name : 'id'},
           {display: 'Username', name : 'username', isdefault: true},
           {display: 'Display Name', name : 'displayname'}
         ],
         sortname: "id",
         sortorder: "desc",
         usepager: true,
         singleSelect: true,
         title: 'Test',
         useRp: true,
         rp: 20,
         showTableToggleBtn: false,
         width: 500,
         height: 250
      });

     // You can setup all the tables you need here.

   });

 </script>