Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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