1

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..

Oleg
  • 220,925
  • 34
  • 403
  • 798
Tommy1209
  • 179
  • 3
  • 12
  • Could you describe more exactly the problem? How you hide/show the columns? Do you use `columnChooser` or you call `showCol`, `hideCol`, `showHideCol` directly? What you mean "frozen is not working"? What exactly "not working"? Are the height/width of frozen columns is unchanged? It's better to provide the demo, which can be used to reproduce the problem. – Oleg Mar 21 '17 at 08:32
  • @Oleg, thanks for quick reply, I use "hideCol". After hide columns, columns frozen before not locked and the height/width of them not changed – Tommy1209 Mar 21 '17 at 08:51

1 Answers1

1

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.

Oleg
  • 220,925
  • 34
  • 403
  • 798