Created
January 3, 2019 08:54
-
-
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...
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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