Skip to content

Commit 1ad5309

Browse files
committed
Fix for pnp#86
1 parent 16b13aa commit 1ad5309

File tree

5 files changed

+21
-5
lines changed

5 files changed

+21
-5
lines changed

CHANGELOG.JSON

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,11 @@
1111
],
1212
"fixes": [
1313
"Bug in `TaxonomyPicker` where values are not updated by an async change [#83](https://github.com/SharePoint/sp-dev-fx-controls-react/issues/83)",
14-
"`FieldUserRenderer` uses email prop for `GetPropertiesFor` [#84](https://github.com/SharePoint/sp-dev-fx-controls-react/issues/84)"
14+
"`FieldUserRenderer` uses email prop for `GetPropertiesFor` [#84](https://github.com/SharePoint/sp-dev-fx-controls-react/issues/84)",
15+
"Fixed issue in single selection mode when all group items were selected in the `ListView` when user clicked on the group header [#86](https://github.com/SharePoint/sp-dev-fx-controls-react/issues/86)"
1516
]
1617
},
17-
"contributions": []
18+
"contributions": ["Asish Padhy", "Alex Terentiev"]
1819
},
1920
{
2021
"version": "1.4.0",

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
- Bug in `TaxonomyPicker` where values are not updated by an async change [#83](https://github.com/SharePoint/sp-dev-fx-controls-react/issues/83)
1616
- `FieldUserRenderer` uses email prop for `GetPropertiesFor` [#84](https://github.com/SharePoint/sp-dev-fx-controls-react/issues/84)
17+
- Fixed issue in single selection mode when all group items were selected in the `ListView` when user clicked on the group header [#86](https://github.com/SharePoint/sp-dev-fx-controls-react/issues/86)
1718

1819
## 1.4.0
1920

docs/documentation/docs/about/release-notes.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
- Bug in `TaxonomyPicker` where values are not updated by an async change [#83](https://github.com/SharePoint/sp-dev-fx-controls-react/issues/83)
1616
- `FieldUserRenderer` uses email prop for `GetPropertiesFor` [#84](https://github.com/SharePoint/sp-dev-fx-controls-react/issues/84)
17+
- Fixed issue in single selection mode when all group items were selected in the `ListView` when user clicked on the group header [#86](https://github.com/SharePoint/sp-dev-fx-controls-react/issues/86)
1718

1819
## 1.4.0
1920

src/controls/listView/ListView.tsx

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as React from 'react';
22
import { DetailsList, DetailsListLayoutMode, Selection, SelectionMode, IGroup } from 'office-ui-fabric-react/lib/DetailsList';
33
import { IListViewProps, IListViewState, IViewField, IGrouping, GroupOrder } from './IListView';
4-
import { IColumn } from 'office-ui-fabric-react/lib/components/DetailsList';
4+
import { IColumn, IGroupRenderProps } from 'office-ui-fabric-react/lib/components/DetailsList';
55
import { findIndex, has, sortBy, isEqual, cloneDeep } from '@microsoft/sp-lodash-subset';
66
import { FileTypeIcon, IconType } from '../fileTypeIcon/index';
77
import * as strings from 'ControlStrings';
@@ -376,6 +376,18 @@ export class ListView extends React.Component<IListViewProps, IListViewState> {
376376
* Default React component render method
377377
*/
378378
public render(): React.ReactElement<IListViewProps> {
379+
let groupProps: IGroupRenderProps = {};
380+
// Check if selection mode is single selection,
381+
// if that is the case, disable the selection on grouping headers
382+
if (this.props.selectionMode === SelectionMode.single) {
383+
groupProps = {
384+
headerProps: {
385+
onToggleSelectGroup: () => null,
386+
onGroupHeaderClick: () => null,
387+
}
388+
};
389+
}
390+
379391
return (
380392
<div>
381393
<DetailsList
@@ -386,7 +398,8 @@ export class ListView extends React.Component<IListViewProps, IListViewState> {
386398
selection={this._selection}
387399
layoutMode={DetailsListLayoutMode.justified}
388400
compact={this.props.compact}
389-
setKey="ListViewControl" />
401+
setKey="ListViewControl"
402+
groupProps={groupProps} />
390403
</div>
391404
);
392405
}

src/webparts/controlsTest/components/ControlsTest.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ export default class ControlsTest extends React.Component<IControlsTestProps, IC
296296
iconFieldName='ServerRelativeUrl'
297297
groupByFields={groupByFields}
298298
compact={true}
299-
selectionMode={SelectionMode.multiple}
299+
selectionMode={SelectionMode.single}
300300
selection={this._getSelection} />
301301

302302
<p><a href="javascript:;" onClick={this.deleteItem}>Deletes second item</a></p>

0 commit comments

Comments
 (0)