Skip to content

Instantly share code, notes, and snippets.

@ypcode
Created January 3, 2019 08:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ypcode/4802dca7403f90aa91419615ba765175 to your computer and use it in GitHub Desktop.
Save ypcode/4802dca7403f90aa91419615ba765175 to your computer and use it in GitHub Desktop.
Then we need to implement the method that will open and close the Panel...
// Other code here...
import * as React from 'react';
import * as ReactDom from 'react-dom';
// Other code here...
export default class CustomFormPanelCommandSet extends BaseListViewCommandSet<ICustomFormPanelCommandSetProperties> {
// Other code here...
private _showPanel(itemId: number, currentTitle: string) {
this._renderPanelComponent({
isOpen: true,
currentTitle,
itemId,
listId: this.context.pageContext.list.id.toString(),
onClose: this._dismissPanel
});
}
@autobind
private _dismissPanel() {
this._renderPanelComponent({ isOpen: false });
}
private _renderPanelComponent(props: any) {
const element: React.ReactElement<ICustomPanelProps> = React.createElement(CustomPanel, assign({
onClose: null,
currentTitle: null,
itemId: null,
isOpen: false,
listId: null
}, props));
ReactDom.render(element, this.panelPlaceHolder);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment