Skip to content

Fix grid frozenColumn and sidebar toogle

Victor Tomaili edited this page May 3, 2021 · 1 revision

(problem found by @hanneb and solution by @volkanceylan).

Problem: If you set the frozenColumn in getSlickOptions(), the width of the slick grid is not adjusted when collapsing/expanding the sidebar.

Steps to reproduce:

create sample project with Northwind included add to CustomerGrid.ts: protected getSlickOptions(): Slick.GridOptions { let opts = super.getSlickOptions(); opts.frozenColumn = 0; return opts; } start project click top left to expand/collapse sidebar. Notice that the width of the grid is not adjusted.


Solution: This is a problem with frozen columns function and adminlte, as the window height doesn't change it doesn't relayout itself,

Find these lines in app.js:

$("body").removeClass('sidebar-collapse').trigger('expanded.pushMenu'); $("body").addClass('sidebar-collapse').trigger('collapsed.pushMenu'); $("body").removeClass('sidebar-open').removeClass('sidebar-collapse').trigger('collapsed.pushMenu'); $("body").addClass('sidebar-open').trigger('expanded.pushMenu'); and add following after each one:

window.setTimeout(() => $('.require-layout').filter(':visible').trigger('layout'), 500);


Just copy&pasted from this issue

Hope this helps somebody.

John

Clone this wiki locally