Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When grid grouping and freezing columns are used together, the display is not normal #443

Open
songjiqiang opened this issue Sep 24, 2019 · 12 comments

Comments

@songjiqiang
Copy link

When grid grouping and freezing columns are used together, the display is not normal.
The left side of the frozen column is shown as blank
图片

@ghiscoding
Copy link
Collaborator

This might be similar to PR #429

@gavingallagher
That would be really great if you could take a quick look at this issue since you have some knowledge. I assume it might be similar to your PR #429

@ghiscoding
Copy link
Collaborator

ghiscoding commented Dec 22, 2019

@songjiqiang
I took a quick look at this and the problem is because with the frozen the grouping row is actually on 2 different container (1x left container and 1x right container) and the grouping text is always (and only) displayed on the left container, but in your case the text can only be displayed on 2 columns and that is why you can't see the entire text. Basically we have 2 containers (left/right) which are glued to each other, so it looks like a full row but in reality it's not, it's actually 2 rows in 2 different containers and the text will never flow through the row because of that.

So basically the 2 containers are similar to this, also the right container has no column in its cells which is why it shows totally white on the right.

<!-- left container (with grouping text) -->
<div class="grid-canvas grid-canvas-top grid-canvas-left" >
  <div class="ui-widget-content slick-row even slick-group slick-group-level-0" style="top:0px">
    <div class="slick-cell l0 r6 cell-selection frozen">
      <span class="slick-group-toggle expanded" style="margin-left:0px"></span>
      <span class="slick-group-title" level="0">Duration:  5 days  <span style="color:green">(50000 items)</span>
      </span>
  </div>
</div>

<!-- right container (there are no text) -->
  <div class="grid-canvas grid-canvas-top grid-canvas-right">
    <div class="ui-widget-content slick-row even slick-group slick-group-level-0" style="top:0px"> 
  </div>
</div>

I found a quick CSS trick to see the grouping text with position: fixed but that doesn't work so good after scrolling since the text is fixed at a position and you always see it (see animated gif below).

.slick-group-title {
  position: fixed;
  background-color: white;
}

So I think this explains well the problem but I'm not sure how that can be fixed. I'm not sure if flex could help, I'm don't know much about it but maybe. Also the z-index won't help because of how SlickGrid uses the grid.

If someone has a way to bypass this issue, please let us know.

IxLClDyhjS

@Hunt05
Copy link
Contributor

Hunt05 commented Aug 6, 2020

@songjiqiang, I had the same problem. Can you try setting the width of the grid container before rendering the grid/ Slick.Grid() call. It solved my problem. In my case what happens is width : 0px for grid so non-frozen part was not displayed (in my case non-frozen part of grid) .
on $container.width() returns 0 so it was not displayed but grid-canvas div width was there only problem with slick-viewport and slick-pane div.

@ghiscoding
Copy link
Collaborator

@Hunt05
It would be really helpful if you could create a Pull Request with a new Examples combining the 2 features, we could then close this issue. It has been asked multiple times and I'd like to see your final solution turned into an Example.

@Hunt05
Copy link
Contributor

Hunt05 commented Aug 6, 2020

@ghiscoding, I have raised a pull request to add example file for frozen columns and cell grouping. In this example, width is not set before rendering the grid it is already provided in div#myGrid. Thanks.

@ghiscoding
Copy link
Collaborator

ghiscoding commented Aug 6, 2020

I saw but unfortunately, that doesn't seem to fix the issue if we put the freeze on first column, frozenColumn: 0

Did I miss something? I'd be interested to know if you really got this behavior fixed.
Thanks.

@Hunt05
Copy link
Contributor

Hunt05 commented Aug 6, 2020

Sorry, I misunderstand the issue. My problem is not with the group header it is with displaying the cells by setting width.

@ghiscoding
Copy link
Collaborator

Just to clear, you don't have a fix for this opened issue then? correct?

@Hunt05
Copy link
Contributor

Hunt05 commented Aug 6, 2020

Yes, It is still open. Example can be used for frozen columns with cell grouping.

@ghiscoding
Copy link
Collaborator

Do you mean cell colspan? I don't see that in your example, can you maybe make a print screen of what you mean?

@speige
Copy link

speige commented Apr 13, 2022

I thought I had a hack, but it's not quite working

.slick-group, .slick-viewport-left, .slick-pane-left, .frozen.true {
  overflow: visible !important;
}

// grouping row html

<div style="position: absolute;">
  <div style="width: 97vw; overflow: visible;">
    A really long header text that causes overflow past frozen column boundary
  </div>
</div>

Bug: Disables vertical scrollbar, so it only works if you don't have very many rows. Mousing over grouping row causes it to flicker.

Other Notes:

  1. This hides the horizontal scrollbar on the left-pane, hopefully for frozen columns you only need the right-pane scrollbar.
  2. I used 97vw, you will have to experiment with what works for your situation. I couldn't use 100vw because it doesn't account for the browser vertical scrollbar. If your slickgrid is not full-screen, you may want smaller than 97vw. The group header can't be wider than 100vw because the header is not designed to scroll with the horizontal scrollbar.

@speige
Copy link

speige commented Apr 14, 2022

I found an alternative workaround. Use a short group header with a bootstrap tooltip on hover. Bootstrap uses popper.js which adds elements to the body but positions them correctly using javascript. This allows it to avoid the clipping issue of the scroll area.

Bootstrap tooltips are a bit tricky with dynamically rendered elements, especially since Slickgrid uses virtual scrolling & removes elements from the DOM when outside the viewport.

I added a setTimeout in the grouping formatter function to call bootstrap tooltip immediately after rendering the html.
I also added a slickgrid scroll event handler to also call the tooltip function.

I tried converting the tooltips to 'manual' trigger & have them always visible, but it caused overflow problems when scrolling a row completely out of the grid viewport.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants