你如何初始化其他標籤上的jqGrids?你應該對它們進行初始化時使用show
事件所示的標籤,例如:
jQuery(document).ready(function() {
var initialized = [false, false];
jQuery('#tabs').tabs({show: function(event, ui) {
if (ui.index == 0 && !initialized[0]){
// Initialize grid on second tab page here...
jQuery(NOMBRE_GRID).jqGrid({
url: '/Idiomas/DatosGrid/',
datatype: 'json',
mtype: 'GET',
height: 'auto',
multiselect: true,
autowidth: true,
colNames: ['Id', 'Nombre'],
colModel: [
{ name: 'id_idioma', index: 'id_idioma', width: 100, align: 'left',
formatter: 'showlink', formatoptions: { baseLinkUrl: '/Idiomas/', showAction: 'Edit', addParam: '' }
},
{ name: 'nombre', index: 'nombre', width: 100, align: 'left' }
],
pager: jQuery(NOMBRE_AREA_PAGINACION),
rowNum: tamanoPagina,
rowList: [5, 10, 15, 20],
sortname: 'nombre',
sortorder: 「asc」,
viewrecords: true,
caption: 'Idiomas'
}).navGrid(NOMBRE_AREA_PAGINACION, { edit: false, add: false, del: false, refresh: false, search: false });
});
} else if (ui.index == 1 && !initialized[1]){
// Initialize grid on second tab page here...
jQuery(NOMBRE_GRID_SELECCIONADOS).jqGrid({
url: '/Idiomas/DatosGrid/',
datatype: 'json',
mtype: 'GET',
height: 'auto',
multiselect: true,
autowidth: true,
colNames: ['Id', 'Nombre'],
colModel: [
{ name: 'id_idioma', index: 'id_idioma', width: 100, align: 'left',
formatter: 'showlink', formatoptions: { baseLinkUrl: '/Idiomas/', showAction: 'Edit', addParam: '' }
},
{ name: 'nombre', index: 'nombre', width: 100, align: 'left' }
],
sortname: 'nombre',
sortorder: 「asc」,
viewrecords: true,
caption: 'Idiomas'
});
initialized[ ui.index ] = true;
});
如果你正在做的這個方法,你還需要跟蹤時,每個網格初始化,所以你不要嘗試如果用戶點擊另一個選項卡,則再次創建它,然後單擊回到上一個選項卡。
嗨賈斯汀! 感謝您回覆:-) 請參閱 上的代碼示例http://www.trirand.com/blog/?page_id=393/help/autowidth-with-jquery-tabs&value=ui.tabs.js% 25251&search = 1 –
我已經更新了我的回答。這是否解決了這個問題? –
是的。爲我工作...謝謝。 現在,如何刷新第2或第3標籤點擊第一個標籤? 謝謝 –