Comments (2)
@dsmorse - Is there any method built in that I can call once items have been dynamically added to the DOM for it to know there the items are since they are not added with the "Add" method? I assume there is an underlying grid of available spots and what not and these aren't updated when the plugins are loaded directly into the DOM.
from gridster.js.
I know I'm a bit late to this, but I was having the same problem. So what I did was that I ordered the items before I started adding them to gridster.
The problem is that gridster isn't obeying to the position of certain elements, like if the first one in the array is positioned at the "row 5, col 1", it gets rendered first and it will go to "row 1, col 1" for some reason.
So what I do is the following:
exampleArray.sort(function (a, b) {
var aRow = a.layout.row;
var bRow = b.layout.row;
var aCol = a.layout.col;
var bCol = b.layout.col;
if (aRow == bRow) {
return (aCol < bCol) ? -1 : (aCol > bCol) ? 1 : 0;
} else {
return (aRow < bRow) ? -1 : 1;
}
});
This will return you guys your array ordered per row and column and Gridster will be able to render them correctly.
from gridster.js.
Related Issues (20)
- Not able to drag and drop widgets even if there is space available
- When i remove widget so drag and drop fetaure are not working HOT 1
- gridster height auto
- Can gridster prevent link clicks while dragging? HOT 2
- draggable handle doesnt work as expected. HOT 1
- BUG: avoid_overlapped_widgets and collision wait_for_mouseup false fails
- FEATURE REQUEST: Resize only certain items HOT 2
- BUG: resize specific axes 'x' does not work (grid crashes)
- Is this project abandoned?
- BUG: Destroy() and re-intialize fails to allow draggable HOT 1
- Widget are floating on top of another widgets when we change the machine scaling and zoom Out browser
- BUG: Using add_widgets dont allow resizing until page refresh HOT 1
- shift_widgets_up not working, also add shift_widgets_left
- CSS Grid API
- Bower 0.8.0
- Static elements get pushed away by another element being resized
- Nothing
- jQuery.fn.bind() is deprecated in Gridster.js
- How to implement drag-and-drop from a list of items outside the layout?
- Dynamically loading 2 (or more) grids isn't working HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gridster.js.