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

ScrollablePane with DetailsList cannot scroll fixed header with list content #5116

Closed
luckyyd opened this issue Jun 6, 2018 · 4 comments
Closed
Assignees

Comments

@luckyyd
Copy link

@luckyyd luckyyd commented Jun 6, 2018

Bug Report

  • Package version(s): 5.106
  • Browser and OS versions: Chrome, Windows 10

Priorities and help requested (not applicable if asking question):

Are you willing to submit a PR to fix? (Yes, No)
No
Requested priority: (Blocking, High, Normal, Low)
High
Products/sites affected: (if applicable)

Describe the issue:

When using DetailsList within Scrollable Pane, if the DetailsList has more columns that exceeds the div width, when scroll below, both column header and detailslist appears both horizontal scroll bar, but cannot scroll together:
Scroll to the top:
image
Scroll down
image

Expected behavior:

The sticky header should scroll with detailslist together.

If applicable, please provide a codepen repro:

Code:
image

@leddie24 leddie24 self-assigned this Jun 6, 2018
@kirankumarmanku
Copy link

@kirankumarmanku kirankumarmanku commented Jun 11, 2018

Hi,
I am also facing the similar issue with DetailsList with ScrollablePane. Is there any temporary workaround for this?

@kirankumarmanku
Copy link

@kirankumarmanku kirankumarmanku commented Jun 11, 2018

Hi,
Following fix worked for me. I have added onScroll event for the div containing ScrollablePane and attached the following method.

private handleScroll(event) {
  let element = document.querySelector("[class*='stickyAbove-']");
  if(element != null)
      element.scrollLeft = event.target.scrollLeft;
}

I am returning following element.


     <div style={ {
          height: '100%',
          position: 'relative',
          maxHeight: 'inherit'
        } }
          onScroll = {this.handleScroll}
         >
              <ScrollablePane>
                <DetailsList
                  items={ sortedItems as any[] }
                  columns={ columns }
                  compact={false}
                  ariaLabel= "List of data"
                  setKey='items'
                  className = {styles.myclass}
                  layoutMode={ DetailsListLayoutMode.fixedColumns }
                  onRenderDetailsHeader={
                    // tslint:disable-next-line:jsx-no-lambda
                    (detailsHeaderProps: IDetailsHeaderProps, defaultRender: IRenderFunction<IDetailsHeaderProps>) => (
                      <Sticky 
                      stickyPosition={StickyPositionType.Header} >
                        { defaultRender({
                          ...detailsHeaderProps,
                           onRenderColumnHeaderTooltip: (tooltipHostProps: ITooltipHostProps) => <TooltipHost {...tooltipHostProps} />
                        }) }
                      </Sticky>
                    ) }
                  selectionMode={SelectionMode.none}
                  constrainMode = {ConstrainMode.unconstrained}
                  onColumnHeaderClick={ this.onColumnClick }
                />
              </ScrollablePane>
         </div>
@coreyroth
Copy link

@coreyroth coreyroth commented Oct 3, 2018

I have found that you also need to capture the scroll event on the Sticky as well in case the user scrolls the header. I registered a scroll event with the following:

public componentDidMount(): void { let stickyElemrent = document.querySelector("[class*='stickyAbove-']") if (stickyElemrent != null) { stickyElemrent.addEventListener('scroll', this.hnadleStickyScroll); } }

Then I used a similar event handling method:

private hnadleStickyScroll(event) { let gridElement = document.querySelector("[class*='ms-DetailsList']"); if (gridElement) gridElement.scrollLeft = event.target.scrollLeft; event.preventDefault(); }

I wrote more on it in this post.

@nealYangVic
Copy link

@nealYangVic nealYangVic commented Mar 20, 2019

StickyPositionType.Both will make it work directly....

@microsoft microsoft locked as resolved and limited conversation to collaborators Aug 30, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

6 participants
You can’t perform that action at this time.