You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* all events are now handled by GridStack and no longer use jquery - changed the signature of some.
* removed all $ jquery out of main code (engine, util and now gridstack.ts)
* fixed `dragstop | resizestop` to be called *after* we update the node attributes
no need for old `gsdragstop` - if you call `grid.on()` events rather than directly jquery events.
part of gridstack#1084
still TODO: deeper testing to make sure I didn't break anything. Checking in wkd work now.
Copy file name to clipboardExpand all lines: README.md
+6-4Lines changed: 6 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -332,19 +332,21 @@ We're working on implementing HTML5 drag'n'drop through the plugin system. Right
332
332
333
333
make sure to read v1.0.0 migration first!
334
334
335
-
v2.x is a Typescript rewrite of 1.x, using classes and overall code cleanup. Your code might need to change from 1.x
335
+
v2.x is a Typescript rewrite of 1.x, removing all jquery events, using classes and overall code cleanup. Your code might need to change from 1.x
336
336
337
-
1. In general methods that used no args = getter vs setter are not used in Typescript.
337
+
1. In general methods that used no args (getter) vs setter are not used in Typescript.
338
338
Also legacy methods that used to take tons of parameters will now take a single object (typically `GridstackOptions` or `GridstackWidget`).
339
339
340
340
```
341
341
removed `addWidget(el, x, y, width, ...)`--> use the widget options version instead `addWidget(el, {with, ...})`
342
342
`float()` to get value -->`getFloat()`
343
-
'cellHeight()` to get value --> `getCellheight()`
343
+
'cellHeight()` to get value --> `getCellHeight()`
344
344
'verticalMargin()` to get value --> `getVerticalMargin()`
345
345
```
346
346
347
-
2.`oneColumnMode` would trigger when `window.width`<768px by default. We now check for grid width instead (more correct and supports nesting). You might need to adjust grid `minWidth` or `disableOneColumnMode`.
347
+
2.event signatures are generic and not jquery-ui dependent anymore. `gsresizestop` has been removed as `resizestop|dragstop` are now called **after** the DOm attributes have been updated.
348
+
349
+
3.`oneColumnMode` would trigger when `window.width`<768px by default. We now check for grid width instead (more correct and supports nesting). You might need to adjust grid `minWidth` or `disableOneColumnMode`.
@@ -134,19 +134,21 @@ all item options are also available as HTML attributes using the `data-gs-` name
134
134
135
135
## Events
136
136
137
-
Those are the events set by the grid when items are added/removed or changed - they use standard JS calls with a CustomElement `detail` that stores the list
138
-
of nodes that changed (id, x, y, width, height, etc...).
137
+
Those are events generated by the grid when items are added/removed/changed or drag&drop interaction. In general they pass list of nodes that changed (id, x, y, width, height, etc...) or individual DOM element
138
+
that is affected.
139
139
140
-
You can call it on a single event name, or space separated list:
140
+
You can call it on a single event name, or space separated list like:
141
141
`grid.on('added removed change', ...)`
142
142
143
+
The Typescript `GridStackEvent` list all possible values, and nothing else is supported by the `grid.on()` method, though it's possible to register directly for other events generated by the drag&drop plugging implementation detail (currently jquery-ui based).
let x =parseInt(el.getAttribute('data-gs-x')) ||0;
188
+
// or all values...
189
+
let node: GridStackNode =el.gridstackNode; // {x, y, width, height, id, ....}
186
190
});
187
191
```
188
192
189
193
### dropped(event, previousWidget, newWidget)
190
194
195
+
called when an item has been dropped and accepted over a grid. If the item came from another grid, the previous widget node info will also be sent (but dom item long gone).
0 commit comments