tonytomov / jqGrid

jQuery grid plugin
www.trirand.com
2.84k stars 1.2k forks source link

`footerrow` problem using `setFrozenColumns`, `groupingView` and `height:'auto'` #1041

Closed parallels999 closed 11 months ago

parallels999 commented 11 months ago

https://jsfiddle.net/6pa0ts37/3/

image

~UPDATE:~ ~https://jsfiddle.net/79qz5gym/, I fix it by adding:~

onClickGroup: () => {
  grid.destroyFrozenColumns();
  grid.setFrozenColumns();
}

UPDATE 2: Fixed on core

tonytomov commented 11 months ago

Please, read the docs for the limitations when frozen columns are on

parallels999 commented 11 months ago

hi @tonytomov , thanks for the quick answer

is this a frozen columns limitation too? when the grid has no visibility, setGroupHeaders set no text on the first header, with visibility works as expected https://jsfiddle.net/ocxyrpb8/1/ image

parallels999 commented 11 months ago

This could be fixed easy adding the next code on groupingToggle

if(frz && $t.p.height === 'auto'){
  $t.grid.fbDiv.height($($t).height());
  if($t.grid.fsDiv) {
    // the size of the borders would be needed, maybe 2px?? also scrollbar height
    $t.grid.fsDiv.css('top', ($t.grid.fbDiv.position().top + $($t).height()) + 'px');
  }
}

Here: https://github.com/tonytomov/jqGrid/blob/630d3d84856967a257f516c82ef5d4707c10a3c3/js/grid.grouping.js#L274-L275

WORKING DEMO: https://jsfiddle.net/6busLny4/

tonytomov commented 11 months ago

setFrozenColumns as described into the docs should be called as last method. In one of your example https://jsfiddle.net/ocxyrpb8/1/ you call it before grouping which causes the problem. If you call frozen columns after grouping the result will be as expected.

As for your recommendation I will check it - thanks.

parallels999 commented 11 months ago

https://jsfiddle.net/ocxyrpb8/1/ you call it before grouping which causes the problem, If you call frozen columns after grouping the result will be as expected

I already changed the order, it's the same result DEMO: https://jsfiddle.net/gmezbxfL/1/ image

tonytomov commented 11 months ago

As last method- after visibility setting

$('#jqGridParent').css('visibility','');
parallels999 commented 11 months ago

As last method- after visibility setting

That is the problem that I describe, when the grid does not have visibility, frozen does not work correctly, I have a hidden grid, and when the grid is displayed the header has no text,

when the grid has no visibility, setGroupHeaders set no text on the header,

I did add the $('#jqGridParent').css('visibility',''); and <div id="jqGridParent" style="visibility:hidden;"> to show the problem, Of course without these changes it works correctly, even if I put it after $('#jqGridParent').css('visibility','');, but in my case I have tabs and the grid is hidden until the user activates the tab

tonytomov commented 11 months ago

Thanks. I have fixed the visibility problem.

Your fix for height auto isn't enough - in your example try to resize some column - the footer text disappear. This also is another bug independent if grouping is on or off

parallels999 commented 11 months ago

Thanks, looks great to me, I hope the change doesn't affect anyone.

Your fix for height auto isn't enough ... in your example try to resize some column - the footer text disappear.

it is because text was added by brute force directly in the frozen footer with

$('.frozen-sdiv').find('td').html('test'); // set values on the frozen TDs

There is no bug on resize, look: https://jsfiddle.net/jbu4wak0/

tonytomov commented 11 months ago

Thanks. I have seen this minute after writing the answer, and have decision to leave it - to remember me that I should read the code carefully.

Thank you again for your investigations and fixes.