2015-09-25 83 views
0

我有一個面板惠特4選項卡,當我單擊一個選項卡,我想加載到datagrid的數據。 我把通用名稱 這是我的代碼:加載datagrid時選擇選項卡,easyui

function create_datagrid() { 
$('#grid_name').datagrid({ 
    url: "some url", 
    title: 'Table', 
    singleSelect: 'true', 
    columns: [[ 
      {field: 'id', title: 'ID', with : 100, hidden: true}, 
      {field: 'fabricante', title: 'Nombre', with : 100, sortable:true} 
     ]] 
    }); 
} 

$('#tt').tabs({ 
    onSelect: function (title) { 
     $("#grid_name").ready(function() { 

      create_datagrid(); 

     }); 
    } 
}); 

回答

1

試試這個:

 $('#tt').tabs({ 
      onSelect: function (title) { 
       if (title == 'title1'){ //title tab 1 
        $('#grid_name1').datagrid('reload'); 
       } 
       if (title == 'title2'){ //title tab 2 
        $('#grid_name2').datagrid('reload'); 
       } 
       //and so on... 
     });