New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dragging widget into parent grid and nested child grid #992
Comments
@ygalanter I just meet the same problem? Have you resolve this problem? If so, how? Looking forword for your reply. Thank you very much. |
I think you can take a look at this #133. I think you need to play with the property "AcceptWidget" and css selector to achieve this. |
#1105 I just checked in will get you almost there - I updated nested.html to show drag&drop between 2 nested grids, but dragging a regular item into another nested one has tons of issues - it wants to push the outer one first, then can drop into it - causing issues of 2 drop targets. You can un-comment some settings to try. Not an easy fix |
@RdeWilde in https://gridstackjs.com/demo/nested.html
as you can see this is not easy to even design... |
Thanks @adumesny for setting an outline. I have limited experience ofcourse, you are the expert here, but here's my thought:
|
@RdeWilde comments: | Or you have to divide items into different drop targets. 33% left is insert left, 33% right is insert right, other 34% is nest inside. wouldn't work as you drag over the first 1/3rd, the item would be pushed out of the way and you couldn't get to the mid point to insert nested instead (would be weird to bring item underneath again if you continue moving over nothing to insert) | Or you can have an icon inside the div to start dragging for nesting. Stripo has such labels in their editor as a lib I can't insert any affordances (I don't even enforce the type of DOM element just added classes) BUT you sure could and switch mode (insert vs move) for them. I think I will add that as a mode and have Alt key by default switch mode, but you could add UI to control which mode you're in. | Or show a context menu/popup on drop about what action to take again, lib can't have UI and you can't do after the fact as the feedback would be move or insert but not both...
|
Sounds good to me @adumesny |
No Alt key, no moving "nested 1" out of the way. I just need dropping in (which works now)
I need to drag an item out of a subgrid into a parent grid, and vice-versa.
It would be an awesome feature, but I personally don't need this right now, considering how difficult it would be to implement.
No need to convert an item into a nested grid for now.
Same as my answer to Q4. |
https://github.com/gridstack/gridstack.js/blob/master/demo/nested.html#L50
This is where I am stuck. I need to set acceptWidgets: '.grid-stack-item' (or true) to the subGrid and its parent grid. |
r.movVideo of not being able to put an item back into a sub grid, while dragging it out of the sub grid into its parent grid works fine. |
* fix to make gridstack#992 better going forward as I'm focusing on nested grids again * dragging sub item between grids no longer get clipped by parent * removed basePosition.aboslute option as I'm not sure how we can make it work (parent has position.relative which will clip us otherwise) * nested.html you can drag pink items between grids (h5 case, JQ still clipps)
got most of it working for upcoming release... thanks to @arclogos132 for actually funding this! 20211226_212858.mp4 |
That looks beautiful |
* fix gridstack#992 * we now support dragging into and out of nested grids from parents * nested.html was updated to showcase this, settings all grids to accept the same widgets. using CSS to differentiate nested items vs not for styling/demo purpose only. * tested nested, float nad two.html - all seem to continue working (this was a lot of work to fine tune) * also fix gridstack#1558 as we no longer cache the grid position (as we may move when items are placed elsewhere) but get it on every move to reflect latest data Thank you [@arclogos132](https://github.com/arclogos132) for sponsoring it.
some issue remain (nested within nested break things) - re-opening 20211229_092538.mp4 |
fixed 20211229_221207.mp4 |
* remaining fix for gridstack#992 to prevent a nested grid from going inside another until we can do the right thing down the line. Very broken otherwise * also fixed heuristics to work like regular items (ignore enter/leave for sub grid dragging)
* more partial fix for gridstack#1009 and gridstack#992 * you can now drag a nested grid over another one and nest it deeper (992) * fixed size transition * fixed handlers not set when nesting TODO: fix pause to work for enter/leave, more nested testing. Fix tests
got the nested drag (which was disabled) fixed as part of #1009 (changelist #2052) for v7 20220926_070947.mp4but the mouseenter event is used today to add items to a grid, when it should really be 50% coverage like between items - so you can't really push vs nest between sub-grid (depending on where your cursor is) - that will have to be future tweaks |
I am trying to create this behavior and not sure whether Gridstack supports it or not. I have 3 grids: Grid1, Grid2, and Grid3. Grid1 is a standalone grid and Grid3 is nested inside Grid2. I need to be able to drag widgets from Grid1 both into Grid2 (outer grid) and into Grid3 (nested grid). Following samples I was able to drag widgets between 2 top level grids and create a nested grid, but not combining these 2 together. If this is supported - any pointers are appreciated.
The text was updated successfully, but these errors were encountered: