我使用jQuery的手風琴,每當頁面刷新和手風琴內slickgrid Slickgrid內jQuery的手風琴列被擴大了網格內的列都失靈和破壞。我試過用
grid.resizeCanvas();
在我的手風琴裏無濟於事。
這是我的代碼。
var grid = (grid1, grid2, grid3);
$('#accordion').accordion({
collapsible: true,
beforeActivate: function (event, ui) {
grid.resizeCanvas();
// The accordion believes a panel is being opened
if (ui.newHeader[0]) {
var currHeader = ui.newHeader;
var currContent = currHeader.next('.ui-accordion-content');
// The accordion believes a panel is being closed
} else {
var currHeader = ui.oldHeader;
var currContent = currHeader.next('.ui-accordion-content');
}
// Since we've changed the default behavior, this detects the actual status
var isPanelSelected = currHeader.attr('aria-selected') == 'true';
// Toggle the panel's header
currHeader.toggleClass('ui-corner-all', isPanelSelected).toggleClass('accordion-header-active ui-state-active ui-corner-top', !isPanelSelected).attr('aria-selected', ((!isPanelSelected).toString()));
// Toggle the panel's icon
currHeader.children('.ui-icon').toggleClass('ui-icon-triangle-1-e', isPanelSelected).toggleClass('ui-icon-triangle-1-s', !isPanelSelected);
// Toggle the panel's content
currContent.toggleClass('accordion-content-active', !isPanelSelected)
if (isPanelSelected) { currContent.slideUp(); } else { currContent.slideDown(); }
return false; // Cancels the default action
}
});
更新 我一直在使用
var grid = [grid1, grid2, grid3];
$("#accordion").accordion({
afterActivate: function (event, ui) {
grid[0].resizeCanvas();
}
});
這也沒有工作不幸嘗試。
嘗試使'網格'數組。 'var grid = [grid1,grid2,grid3];'然後訪問它們像'grid [0] .resizeCanvas();' –
嘗試,目前沒有任何成功。當您關閉手風琴時,所有列在關閉動畫完成之前重新組織。 –
手風琴上有'afterActivate'功能嗎?通常情況下,容器div需要可見並具有網格佔用的高度。 – Edward