-
Notifications
You must be signed in to change notification settings - Fork 45
Javascript Methods #15
Comments
Hi @MarkPerryBV, to answer your questions in order:
I hope this is helpful. |
@ivank Thanks for the reply. The I'll have a play with adding a DIV into the container and see how that works. |
@ivank Any chance your `.ltData()' function could take a callback or similar so I can provide a function which can control the serialisation process. Having all the X,Y,W,H is awesome but I need a way to include my widget id's in that json object. Do you see what I mean? |
Looking at the code it appears that you might need to add a way to allow users to add arbitrary data into the Rect object. This will allow me to add an ID per Rect as well as things like min-w, max-w etc.. I am building a dashboard page where users can expand, reduce widgets and position them. Some widgets need to be set so they can be a minimum of 2x2. |
I'll think about it more, but you could probably implement your solutions by having the min-w max-w constraints enforced outside of layout-grid. You'll need to validate that data server-side anyway As for the ID - the divs themselves don't get rearranged when they are dragged about, so the index of the divs can be used as their "ID" for the time being. And your suggestion for a callback might be a good thing to implement regardless. |
Just been playing around with the serialization methods and I don't think it's usable without serializing all the sizes xs, sm, md, lg. Lets say you are currently using the 'lg' browser width and we serialize out the positions. If we then try and load these positions back when the browser width is anything but in the 'lg' size the layout of the rects is all wrong. Also if I just use the classes of -xs- for specifying the X, Y, W, H then it just stacks the rects at 100% width all of the time. I was hoping I didn't need to specify all the classes on every element but it simply doesn't work correctly unless you do. |
Hi @MarkPerryBV, I've been playing around with building an admin interface with this myself, and realised there are some features missing. I've just implemented them and also made a quick demo of how you can accomplish such an interface: (also moved to using sphinx for docs generation which is much saner than jekyll. |
The docs are a lot better =). You are still missing a few features though. 1.) Can you make the 2.) Having all the positions of the grid is still not enough as I need a way to save the "id" of the rect in question. Having all the sizes is great but I still need a way to save what content was in what rect. Some sort of data parameter or call back is needed when the serialization is done. |
After reading the docs site I have a couple of questions:
1.) Can you dynamically add a "rect" to the Grid after the initial Grid has rendered?
2.) Can you serialize the "rects" out to a js object or array so that I can create a save/load of positions for re-creating a dashboard?
The text was updated successfully, but these errors were encountered: