-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathapp.jsx
More file actions
55 lines (49 loc) · 1.5 KB
/
app.jsx
File metadata and controls
55 lines (49 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import * as React from 'react';
import { useRef, useCallback } from 'react';
import { createRoot } from 'react-dom/client';
import { SpreadsheetComponent } from '@syncfusion/ej2-react-spreadsheet';
import { DialogComponent } from '@syncfusion/ej2-react-popups';
function App() {
const dialogRef = useRef(null);
const openDialog = () => {
dialogRef.current.show();
};
const closeDialog = () => {
dialogRef.current.hide();
};
const onDialogOpen = useCallback(() => {
setTimeout(() => {
window.dispatchEvent(new Event('resize'));
}, 0);
}, []);
return (
<div className="page">
<header className="header">
<h3 style={{ margin: 0 }}>Spreadsheet inside Dialog</h3>
<div style={{ marginLeft: 'auto' }}>
<button onClick={openDialog}>Open Spreadsheet</button>
</div>
</header>
<DialogComponent
ref={(dlg) => (dialogRef.current = dlg)}
isModal={true}
visible={false}
header="Spreadsheet"
showCloseIcon={true}
minHeight="80vh"
width="80vw"
height="80vh"
allowDragging={true}
closeOnEscape={true}
target={document.body}
overlayClick={closeDialog}
open={onDialogOpen}
>
<SpreadsheetComponent height="100%" width="100%" />
</DialogComponent>
</div>
);
}
export default App;
const root = createRoot(document.getElementById('root'));
root.render(<App />);