2015-09-25 5 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... 
     }); 
Смежные вопросы