jqgridfree-jqgridfrozen-columns

free-jqgrid: hide/show column affect to frozen column?


I have a jqgrid with 2 frozen columns. Frozen works fine if I do not anything. After I hide/show another columns (not frozen columns) frozen is not working.

I use free jqGrid version 4.14.0

I don't know what happen.

Can anyone help me! Thanks in advance..


Solution

  • If you use low-level methods showCol, hideCol, showHideCol directly then you should choose yourself which one from two solution ways provides the best performance in your case.

    Showing/hiding of columns is relatively slow, because all rows of the grid, column headers (inclusive the filter toolbar) need be looked through and the inline css style on the corresponding cells be changes (display property should be set to none or the none value should be removed). After that the with and the height of the grid could be changed too. If the grid has frozen columns, then the same should be done in the frozen dives. Additionally the width and the height of frozen dives should be recalculated and the height of every row of the frozen columns should be recalculated too.

    Thus one have two alternatives:

    1. hide/show all columns which you need by calls of showCol, hideCol, showHideCol and then trigger jqGridResetFrozenHeights event on the grid to force recalculation of all width/height properties of frozen dives
    2. destroy the frozen columns by call of destroyFrozenColumns, apply hiding/showing the columns by calling of showCol, hideCol, showHideCol and to recreate frozen columns once more by call of setFrozenColumns.

    I recommend you to make some tests to choose, which one from the above two ways provides the best performance in your application.