class Dialog extends Component {
constructor() {
super(...arguments);
this.clickEventHandler = this.clickEventHandler.bind(this);
}
content() {
return (
<div className="dialogContent">
<button onClick={this.clickEventHandler.bind(this)}>
Button 1 (pure JS)
</button>{" "}
</div>
);
}
clickEventHandler() {
console.log("clickEventHandler called");
}
render() {
return (
<div className="control-pane">
<div className="control-section" id="rteTools">
<div className="rte-control-section" />
<DialogComponent
visible={true}
showCloseIcon={true}
width="70%"
header="Dialog Header"
height="200px"
allowDragging={true}
content={this.content.bind(this)}
/>
</div>
</div>
);
}
} |
<DialogInteraction header={props.symbol} okClick={okClick}
closeClick={props.closeClick} visible={props.visible} forceWidth="300px" content={content}/>
<DialogComponent width={isMobile ? "98%" : props.forceWidth ? props.forceWidth : "50%"} isModal={true}
header={props.header} position={position} buttons={bothButtons}
showCloseIcon={false} visible={props.visible} content={props.content} />
const content = () => {
return (
<div className="temp">
</div>
)
}
In real life, content has much more tags inside but for simplicity I tried with the above only and still it seems to fail.
Notice that content is assigned to content of DialogInteraction which in turn is assigned to content of DialogComponent.
The above error appears before something is rendered (it's a dialog which is invisible at first).
If I remove content={content} of DialogComponent, the window shows itself but obviously empty.
Notice that I'm using hooks and 16.8.0 coding style of React.
974 | this.contentEle.innerHTML = '';
975 | }
976 | // eslint-disable-next-line
> 977 | typeof (this.content) === 'string' ? (this.isBlazorServerRender()
| ^ 978 | && (this.contentEle.innerText === '')) ?
979 | this.contentEle.insertAdjacentHTML('beforeend', this.sanitizeHelper(this.content)) :
980 | this.updateSanitizeContent() :
this.content is a function, not a string. Maybe it can give a hint.
I did try to replicate it using your sample (using oldschool react coding style) but it works, so I wonder what am I doing wrong.
function content1() {
return (
<div>
blah blah
</div>
)
}
return (
<DialogComponent width={isMobile ? "98%" : props.forceWidth ? props.forceWidth : "50%"} isModal={true}
header={props.header} position={position} buttons={bothButtons}
showCloseIcon={false} visible={props.visible} content={content1} />
);
still the same error, it doesn't like something in the way the content is passed and I get
Node.appendChild: Argument 1 does not implement interface Node.
Hi there
I am encountering exact issue as the OP. Could Syncfusion post possible solution to this issue? It would be good if the solution is written based on function component style
Thanks!