Skip to content

Commit 401399a

Browse files
authored
Merge pull request #2849 from adumesny/master
doc fix #1830
2 parents 83cbecf + e5bf678 commit 401399a

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

doc/README.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -515,19 +515,20 @@ Parameters:
515515

516516
```js
517517
let grid = GridStack.init();
518-
grid.el.appendChild('<div id="gsi-1" gs-x="0" gs-y="0" gs-w="3" gs-h="2" gs-auto-position="true"></div>')
519-
grid.makeWidget('#gsi-1');
518+
// ...create some html content, possibly looking like:
519+
// <div id="item-1" gs-x="0" gs-y="0" gs-w="3" gs-h="2"></div>'
520+
grid.makeWidget('#item-1');
520521
```
521522
### `makeSubGrid(el)`
522523
Used to add a subgrid into an existing grid.
523524
```js
524525
const grid = Gridstack.init()
525-
grid.el.appendChild(`
526-
<div id="gsi-1" gs-x="0" gs-y="0" gs-w="3" gs-h="2" gs-auto-position="true">
527-
<div class="grid-stack" id="nested-grid">
528-
<div id="gsi-2" gs-x="0" gs-y="0" gs-w="3" gs-h="2" gs-auto-position="true"></div>
529-
</div>
530-
</div>`)
526+
// ...create some html content, possibly looking like:
527+
// <div id="gsi-1" gs-x="0" gs-y="0" gs-w="3" gs-h="2">
528+
// <div class="grid-stack" id="nested-grid">
529+
// <div id="gsi-2" gs-w="3" gs-h="2"></div>
530+
// </div>
531+
//</div>
531532
grid.makeSubGrid(grid.el.getElementById('nested-grid'))
532533
```
533534
Make sure that the subgrid is inside of a grid item. It is important to remember that subgrids are themselves grid items capable of containing other grid items.

src/gridstack.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1062,8 +1062,7 @@ export class GridStack {
10621062
*
10631063
* @example
10641064
* const grid = GridStack.init();
1065-
* grid.el.appendChild('<div id="1" gs-w="3"></div>');
1066-
* grid.el.appendChild('<div id="2"></div>');
1065+
* grid.el.innerHtml = '<div id="1" gs-w="3"></div><div id="2"></div>';
10671066
* grid.makeWidget('1');
10681067
* grid.makeWidget('2', {w:2, content: 'hello'});
10691068
*/

0 commit comments

Comments
 (0)