fluentui icon indicating copy to clipboard operation
fluentui copied to clipboard

DetailsList: when grouped onToggleSelectGroup does nothing

Open willtrking opened this issue 9 years ago • 3 comments

Bug Report

  • Package version(s): 0.81.0

Describe the issue:

onToggleSelectGroup is never called when passing it through the groupProps of a DetailsList like so

<DetailsList 
        items={this.state.orderData}
        onRenderItemColumn={this.renderItemColumn}
        columns={this.state.orderColumns}
        selection={this._selection}
        groups={[{
                key:"TEST",
                name:"TEST BUNDLE",
                startIndex:0,
                count:2,
                isDropEnabled:false,
                isShowingAll:true,
                level:1,
        }]}
        groupProps={{
              headerProps:{
                      onToggleSelectGroup:tester
              },
              footerProps:{
                      onToggleSelectGroup:tester
              }
        }}
/>

It looks like this stems from GroupedList on the following line https://github.com/OfficeDev/office-ui-fabric-react/blob/master/packages/office-ui-fabric-react/src/components/GroupedList/GroupedList.tsx#L221

You'll notice the onToggleSelectGroup from props is never called. By contrast, the _onToggleCollapse function right above it does call the appropriate function from props, onToggleCollapse. Additional onToggleCollapse DOES properly get called when passed to a DetailsList

Basically what I'm trying to do here is allow items in a group to ONLY be selected when the group header select box is pressed, and not when the individual items are pressed. I think I'll be able to do this properly as long as onToggleSelectGroup is functioning.

Thanks!

willtrking avatar Dec 06 '16 23:12 willtrking

I can investigate.

dzearing avatar Dec 09 '16 17:12 dzearing

@dzearing Hey David, it looks like this is caused by this code

// override group header/footer props as needed
    let dividerProps = {
      onToggleSelectGroup: this._onToggleSelectGroup,
      onToggleCollapse: this._onToggleCollapse,
      onToggleSummarize: this._onToggleSummarize
    };

    let headerProps = assign({}, groupProps.headerProps, dividerProps);
    let footerProps = assign({}, groupProps.footerProps, dividerProps);
    let groupNestingDepth = this._getGroupNestingDepth(); 

The assign should be let headerProps = assign({}, dividerProps, groupProps.headerProps,); as it is right now the dividerprops are overriding the headerprops rather than the other way around.

That being said I believe that overriding it is the incorrect default behavior. It seems like, at least in the dividerprops, that "onToggleSelectGroup" is a callback for when the group is selected. If HeaderProps overrides divider props then the group won't be selected.

joschect avatar Dec 23 '16 00:12 joschect

We will not be fixing this at this time, closing for now and we can reopen in the future.

gokunymbus avatar Jan 11 '18 19:01 gokunymbus