Skip to content

Commit

Permalink
Merge pull request #208 from dhis2/fix/SharingDialog-props-and-DataTa…
Browse files Browse the repository at this point in the history
…bleContectMenu-initial-position

Fix sharing dialog props and data table context menu initial position
  • Loading branch information
HendrikThePendric authored Mar 20, 2018
2 parents 4501fdf + b8d1f09 commit a997985
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
9 changes: 4 additions & 5 deletions packages/sharing/src/SharingDialog.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class SharingDialog extends React.Component {
componentDidMount() {
this.loadDataSharingSettings();
if (this.props.open && this.props.type && this.props.id) {
this.loadObjectFromApi();
this.loadObjectFromApi(this.props);
}
}

Expand All @@ -53,11 +53,11 @@ class SharingDialog extends React.Component {

if (hasChanged('id') || hasChanged('type')) {
this.resetState();
if (nextProps.open) this.loadObjectFromApi();
if (nextProps.open) this.loadObjectFromApi(nextProps);
}

if (!this.props.open && nextProps.open) {
this.loadObjectFromApi();
this.loadObjectFromApi(nextProps);
}
}

Expand Down Expand Up @@ -119,9 +119,8 @@ class SharingDialog extends React.Component {
});
}

loadObjectFromApi = () => {
loadObjectFromApi = ({ type, id }) => {
const api = this.props.d2.Api.getApi();
const { type, id } = this.props;

api
.get('sharing', { type, id })
Expand Down
5 changes: 5 additions & 0 deletions src/data-table/DataTableContextMenu.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,14 @@ function DataTableContextMenu(props, context) {
.keys(props.actions)
.filter(menuActionKey => typeof props.actions[menuActionKey] === 'function');

// Transition and left styles were added to prevent initial rendering in top-left
// https://github.com/mui-org/material-ui/issues/8040
const cmStyle = {
position: 'fixed',
left: -1000,
transition: 'left 0s, top 0s',
};

const {
actions,
activeItem,
Expand Down

0 comments on commit a997985

Please sign in to comment.