Skip to content

Commit 29778a7

Browse files
[update] React and Angular integration changes
1 parent 344031b commit 29778a7

File tree

2 files changed

+26
-9
lines changed

2 files changed

+26
-9
lines changed

docs/angular_integration.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,15 +120,13 @@ To display Spreadsheet correctly, you need to provide the corresponding styles.
120120
/* specify styles for initial page */
121121
html,
122122
body {
123-
margin: 0;
124-
padding: 0;
125123
height: 100%;
124+
padding: 0;
125+
margin: 0;
126126
}
127127

128128
/* specify styles for the Spreadsheet container */
129129
.widget {
130-
position: relative;
131-
width: 100%;
132130
height: 100%;
133131
}
134132
~~~

docs/react_integration.md

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,27 @@ export default function DHTMLXSpreadsheet(props) {
105105
}
106106
});
107107

108-
return <div ref={container} style={{ width: "100%", height: "100%" }}></div>;
108+
return <div ref={container} className="widget"></div>;
109+
}
110+
~~~
111+
112+
#### Adding styles
113+
114+
To display Spreadsheet correctly, you need to provide the corresponding styles. You can use the **index.css** file to specify important styles for Spreadsheet and its container:
115+
116+
~~~css title="index.css"
117+
/* specify styles for initial page */
118+
html,
119+
body,
120+
#root {
121+
height: 100%;
122+
padding: 0;
123+
margin: 0;
124+
}
125+
126+
/* specify styles for the Spreadsheet container */
127+
.widget {
128+
height: 100%;
109129
}
110130
~~~
111131

@@ -172,7 +192,7 @@ export default App;
172192

173193
Go to the ***Spreadsheet.jsx*** file and apply the passed **props** to the Spreadsheet via the [`parse()`](/api/spreadsheet_parse_method/) method:
174194

175-
~~~jsx {5,10} title="Spreadsheet.jsx"
195+
~~~jsx {5,11} title="Spreadsheet.jsx"
176196
import { useEffect, useRef } from "react";
177197
import { Spreadsheet } from "@dhx/trial-spreadsheet";
178198
import "@dhx/trial-spreadsheet/codebase/spreadsheet.min.css";
@@ -190,9 +210,8 @@ export default function SpreadsheetComponent(props) {
190210
}
191211
});
192212

193-
return <div ref={container} style={{ width: "100%", height: "100%" }}></div>;
213+
return <div ref={container} className="widget"></div>;
194214
}
195-
196215
~~~
197216

198217
The `parse(data)` method provides data reloading on each applied change.
@@ -218,7 +237,7 @@ useEffect(() => {
218237
return () => {
219238
spreadsheet.destructor();
220239
}
221-
}, []);
240+
}, []);
222241
~~~
223242

224243
### Step 3. Adding Spreadsheet into the app

0 commit comments

Comments
 (0)