Giter VIP home page Giter VIP logo

gridstack.js's People

Contributors

adumesny avatar btecu avatar cvillemure avatar dependabot[bot] avatar eflanagan0 avatar ferretwithaberet avatar ffxsam avatar fredericrous avatar hbcarlos avatar jaapz avatar jhadenfeldt avatar juchi avatar julienng avatar kdietrich avatar marcel-necker avatar martynsmall avatar nikcub avatar parano avatar pmoradei avatar radiolips avatar rharriso avatar rhlin avatar ruslan207 avatar shibisuriya avatar stalniy avatar stephenjason89 avatar str avatar troolee avatar vincentmolinie avatar zspitzer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gridstack.js's Issues

Incorrect Positioning in Float mode

I'm having an issue with float mode. It seems that as soon as you click and hold a widget (without actually dragging anywhere), it picks a new location for the widget (as indicated by the placeholder dashed box), 1 or 2 spaces below.

Here is my configuration -
[{"x":0,"y":0,"width":12,"height":5},{"x":0,"y":5,"width":4,"height":2},{"x":4,"y":5,"width":4,"height":2},{"x":8,"y":5,"width":4,"height":2},{"x":0,"y":7,"width":2,"height":2},{"x":3,"y":7,"width":4,"height":2},{"x":7,"y":7,"width":4,"height":2},{"x":8,"y":9,"width":4,"height":2},{"x":0,"y":10,"width":4,"height":2},{"x":4,"y":10,"width":4,"height":2},{"x":9,"y":11,"width":3,"height":2},{"x":0,"y":12,"width":4,"height":2},{"x":4,"y":12,"width":4,"height":2}]

To test this, click and hold one of the widgets in the bottom row. You will see that it instantly incorrectly positions the place holder.

remove_widget el must be a jquery object to work

It appears that the remove_widget method is missing a line at the top:
el = $(el);

Without this line you must pass in a jquery object so the code is actually doing a $($(el))
Like the method add_widget, this method should be expecting "el" to be a string selector.

Height automatically

When I disable dragging and resizing is it possible to make height automatically growing with content?
Than you :)

Dragging widgets around can still cause unexpected changes in other widgets

Looks like this is still happening in certain cases (related to #23). Using the below layout.

[{"widget_id":12,"x":0,"y":0,"width":12,"height":1,"locked":false},{"widget_id":2,"x":0,"y":1,"width":4,"height":3,"locked":false},{"widget_id":3,"x":4,"y":1,"width":8,"height":1,"locked":false},{"widget_id":6,"x":4,"y":2,"width":8,"height":1,"locked":false},{"widget_id":4,"x":4,"y":3,"width":8,"height":1,"locked":false},{"widget_id":7,"x":0,"y":4,"width":12,"height":1,"locked":false},{"widget_id":8,"x":0,"y":5,"width":12,"height":1,"locked":false},{"widget_id":9,"x":0,"y":6,"width":12,"height":1,"locked":false},{"widget_id":15,"x":0,"y":7,"width":12,"height":3,"locked":false}]

To get it happen move the square above the top line. Things are shifted and even if you drag the square back to its original position, the layout has changed.

Knockout demo and dynamic column change on window stretch event

Hi,

I think the work that was done for this project so far is amazing and it would be good to have a demo on how this library can be used using knockout. Also, with regards to bootstrap it would be nice to have some kind of more elaborate layout when the window width/height is changed.

What I mean by that is if you have 3 column widget layout on stretching the layout will change to 2 columns and 1 column at the end....this would be really cool...

Save Data?

This probably isn't the proper place to ask this, but how can I get the data on demand (coordinates, width, height, id)?

It seems like most people would eventually want to save their layout to a database or something else, but I am not finding any information on how to do this.

Add Widget bug

While adding a widget, the constraints of the grid (width and height) are not respected.

Dependencies @Jquery UI - Specify modules to pick

Hello Pavel,

I thank you for your efficient and simple grid on bootstrap.

Would it be possible to specifiy in your release what we must pick from Jquery UI ?
Cause it's 234Ko minified and inside we have accordion and other useless stuff i suppose. :)

method : remove_widget() bug?

When i try to remove a widget i have this error on my chrome debugger

_Uncaught TypeError: Cannot set property 'id' of undefined (gridstack.js:196)

The last 2 lines of the stack are as follow

GridStackEngine.remove_node (gridstack.js:196)
GridStack.remove_widget (gridstack.js:497)

My code that calls the method

myElement = $('#myWidgetDiv'+wc_id)[0].outerHTML;
myElement = $(myElement); // with this line or without same error with the method remove_widget
var grid = $('.grid-stack').data('gridstack');
grid.remove_widget(myElement);

The content of myElement

<div id="myWidgetDiv2" class="grid-stack-item ui-draggable ui-resizable" data-gs-x="7" data-gs-y="0" data-gs-width="5" data-gs-height="13"><div class="grid-stack-item-content"><div class="panel panel-default"><div class="panel-heading panel-move ui-draggable-handle"><span class="pull-right"><button type="button" class="btn btn-default btn-xs btn-remove-widget" title="Supprimer" value="2"><span class="glyphicon glyphicon-trash"></span></button></span>Mes derniers logs</div><table class="table table-condensed table-striped"><thead><tr><th>Objet</th><th>Action</th><th><span class="pull-right">Date</span></th></tr></thead><tbody><tr><td><a href="#" class="widget" title="Frais"><span class="fa fa-taxi"></span> Hotel Suisse</a></td><td><span class="label label-default">Création</span></td><td><span class="pull-right text-muted small">il y a 2 jours</span></td></tr><tr><td><a href="#" class="widget" title="Frais"><span class="fa fa-taxi"></span> Taxi Poissy</a></td><td><span class="label label-default">Création</span></td><td><span class="pull-right text-muted small">il y a 2 jours</span></td></tr><tr><td><a href="#" class="widget" title="Client"><span class="fa fa-briefcase"></span> Aldoluck AG</a></td><td><span class="label label-default">Modif.</span></td><td><span class="pull-right text-muted small">il y a 2 jours</span></td></tr><tr><td><a href="#" class="widget" title="Ressource"><span class="fa fa-users"></span> Abdelkader Aoucif</a></td><td><span class="label label-default">Modif.</span></td><td><span class="pull-right text-muted small">il y a 2 jours</span></td></tr><tr><td><a href="#" class="widget" title="Client"><span class="fa fa-briefcase"></span> Aldoluck AG</a></td><td><span class="label label-default">Modif.</span></td><td><span class="pull-right text-muted small">il y a 2 jours</span></td></tr></tbody></table></div></div><div class="ui-resizable-handle ui-resizable-se ui-icon ui-icon-gripsmall-diagonal-se" style="z-index: 90; display: block;"></div></div>

Please, help :)

Nested gridstacks?

I would like to group widgets to one panel, so I tried to insert a sub gridstack into a "grid-stack-item-content". But resizing or moving widgets leads to several effects...
The widgets of the nested gridstack will be moved to the root gridstack - I tried to fix this by changing the reassignment of widgets in the on_end_moving function (save the original parent of widget, detach and attach to original container instead of "self.container").
The result behaves better (the elements remain in their original container) - but it seems that positioning and sorting of the root-widgets does not only affect the root level widgets but includes nested widgets in some way. Just for fun I commented out the pack and fix-collisions routines - the result did not look so bad (I can move widgets around in the nested container and can move or resize the complete container without any problems - it seems to me that gridstack could basically support my requierement).
Do you know some way to handle multiple nested gridstack instances in one document?

Issue with Widget Overlap

I've discovered an issue with an overlapping widget. My configuration is

"[{"x":0,"y":0,"width":4,"height":3},{"x":4,"y":0,"width":2,"height":4},{"x":6,"y":0,"width":6,"height":5},{"x":0,"y":3,"width":4,"height":2},{"x":0,"y":5,"width":6,"height":3},{"x":6,"y":5,"width":6,"height":2},{"x":0,"y":8,"width":4,"height":6},{"x":4,"y":8,"width":8,"height":5},{"x":4,"y":13,"width":8,"height":2},{"x":0,"y":14,"width":4,"height":2},{"x":4,"y":15,"width":8,"height":3},{"x":0,"y":16,"width":4,"height":2},{"x":0,"y":18,"width":4,"height":2},{"x":4,"y":18,"width":8,"height":2},{"x":0,"y":20,"width":4,"height":1}]"

Essentially when you resize the top left most widget to be higher, the bottom left most widget gets pushed to the top and the two overlap. It seems like the bottom left most widget can not be pushed into another lower row, so it get's push to row 0. Going to look into this, but also wondering if you've seen it or have any suggestions.

Grid of previously saved items does not affect position

Hey,

I cannot set position of previously saved items like described in issue #13
The size of the items are okay but not the position

Is it linked to the _styles attribute from the grid that is not been regenerated as at the time of saving.

I can give you my source files if you need to reproduce the issue ; or discuss about that

Regards,

function locked doesnt lock widget

Hi,
If i use function locked, i get stack-item and want lock it, but if i lock with true i can move with this item.

$(".grid-stack").on('dblclick', function (event, ui) {
var grid = $('.grid-stack').data('gridstack');
var el = event.target;
if (el != null) {
grid.locked(el, true);
}
});

TypeError: Not enough arguments to CSSStyleSheet.insertRule.

Hey,

i found your tool yesterday and thought it would be awesome to implement it in one of my projects. Today you updated your project and now gridstack.js does not work. It throws the following error:

TypeError: Not enough arguments to CSSStyleSheet.insertRule.
self._styles.insertRule(css);

I looked up the error and you are missing an argument with an index. I took index from the for-loop where the method is called and magically it works again ;)

I hope you fix this error, because also the demo does not work at the moment either.

Thanks in advance :)

remove_widget el must be a jquery object to work

It appears that the remove_widget method is missing a line at the top:
el = $(el);

Without this line you must pass in a jquery object so the code is actually doing a $($(el))
Like the method add_widget, this method should be expecting "el" to be a string selector.

Additional Events

It would be useful to be able to listen to additional events - on start moving, on end moving, on start resize, on end resize. For example, may want to be add or remove classes during these events, possibly to supply visual aids to the user during a change. Just like you do with on_change
self.container.trigger('on_start_moving', [event, ui]); or something to that effect

remove_widget with problem when dragdrop after

Hello @troolee

In my project, I use a grid.remove_widget(el). However, after of use this method, and move the widget(drag drop), the grid shows the widget again.

What can be done?

if(checked) { if($("wdgWidgetID").length > 0) { grid.remove_widget($("#wdgWidgetID")); } } else { if($("wdgWidgetID").length == 0) { grid.add_widget("< span id='wdgWidgetID' >Title< /span >", 0, 0, 1, 2, true); } }

Obs.: The span no has space

captura

Att

Not working in jquery 2.1.1

please check this bug.

My code is:

var options = {
    cell_height: 80,
    vertical_margin: 10
};
$('.grid-stack').gridstack(options);

screen

Not able to resize

I don't see anything syntactically different with what I have versus the demo and everything else works great except I can't re-size anything with the drag handle, I can with the re-size function.

I tried putting breakpoints in the source on all the re-size functions there were and none of them fired, its almost like the event isn't being triggered.

Does anything come to mind?

BUG - Non-Float mode is broken in latest version

@troolee Looks like the latest code has broken the "non-float" mode. Even when float is set to false, widgets are not pushed to the top, and behave like just as float mode does. I reverted to the previous gridstack.js to make sure it wasn't on my end. The old version works as expected.

animate resize

Hi,

would you add a function to animate height / width? That would look nice...
something like: grid.resize-animate(child1, 4, 3);

Best Regards,
Peter

Only Draw Needed CSS Classes

With a high data-gs-max-height (and large widgets on the page) it can make resizing and initial load less performant.

For all nodes, just draw the CSS classes +/- 10 cell_heights.
This loop causes the performance problems when max_height is something like 10,000 for example, that loop makes resizing extremely glitchy.

ANIJS not working with widgets

Hi,

i am trying to use ANIJS to animate add/remove of the widgets in the grid but for some reason this would not work. is there any event that gets triggered on add/remove?

the syntax is data-anijs="if: <event_name>, do: animated bounceIn"

thanks,
Nick

Bootstrap classes

...to use actual bootstrap classes col-md-x etc instead of data-gs-width

Can't resize or move widgets in "responsive" mode

I don't know if this is a bug or a feature, but inability to resize/move widgets in responsive mode is quite frustrating.

Also, how can I target the element that was repositioned/resized, I could parse items, but need to target only the element which was modified.

Bug in add_widget with auto_position parameter of "false"

@troolee If you call add_widget with an auto_position parameter of false, it actually uses the auto_position mode.
Looks like its setting el.attr('data-gs-auto-position', auto_position) and when it reads it back it sets the node.auto_position = "false" as a string.
Later, this get's evaluated to true when it does the check
if (node.auto_position == true){}
if ("false" == true) which ends up going into the block.

Width options doesn't works

Hi @troolee,

I am trying to use the gridstack width, changing for 3. Although, this change to 3 columns and the width of external div('.grid-stack') are correct, the width value of "item" stayed in 8,3% and not in 33%.

Is getting so:

https://cloud.githubusercontent.com/assets/3621189/5599368/3ddd6898-92ac-11e4-8a2c-acd65f9f1e32.png

When it should stay that way:

https://cloud.githubusercontent.com/assets/3621189/5599367/3dd99434-92ac-11e4-9cbd-80cc718b62e2.png

The code are:

var options = {width: 3,cell_height: 35,vertical_margin: 10,animate: true}; $('.grid-stack').gridstack(options); var grid = $('.grid-stack').data('gridstack');

// Begin For

grid.add_widget("<div class='grid-stack-item' data-gs-no-resize='true'><div class='grid-stack-item-content'><div class='grid-heading'><small>Label</small></div><div class='grid-body'><div class='text-center'</div></div></div></div>', 0, 0, 4, 2, true);

//End For

Att
Mateus Giuliano

Opacity on Dragging node & Bootstrap

First off, loving Gridstack. It's working for me much better than gridster because of it's compatability with bootstrap. Looks like your demo site and the latest version are out of sync. I'm seeing some issues with the opacity and dashed line on drag. Looks like .grid-stack-item-content got renamed to .box?

Also, I'm considering modifying the js to use actual bootstrap classes col-md-x etc instead of data-gs-width. I was thinking for any cases where bootstrap is not included, a separate css file can be loaded which sets up percentage values for those. What are your thoughts on this?

Bug - Non-Movable/Resizable items should be locked in place

When an item is made "non-movable" & "non-resizable", it should be fixed in place. It seems however that dragging other widgets near it can push the non-movable item out of it's current position. The position of non-movable item should not be considered as a possible new location for the item being dragged.

node.el.detach() breaks focused elements

This line here:
https://github.com/troolee/gridstack.js/blob/master/src/gridstack.js#L675

After calling resize() on an element which has a text field which the user is typing into, detaching and appending again causes the user to lose focus.

Why is detach() called and is there any other way this can be done? Specifically, I am using a rich text editor inside the node and detaching and appending again breaks the editor.

Commenting these lines out fixes my problem, but I'm not sure what problems it will cause.

Dragging widgets around can cause unexpected changes in other widgets

I'm noticing in "float" mode, dragging widgets around the page can cause elements to shift even if the dragged widget is returned to its original position. I think widget positions need to be calculated based on the original layout at time the drag is started, rather than the current visible layout.

I'll try to describe an example. Say you have three widgets in a row. A B C. If I drag C over to where A is, A and B get pushed down to a second row. In the same drag (without letting go), I return C to its original position, A and B stay in their new positions on a second row. (Note: Happens easier if you drag C slowly back to its original position). This also happens if you cause reposition via resizing.

I think I've seen this bug occur in non-float mode as well, but it definitely occurs more regularly in float mode because of the nature of float mode.

Touch Support

It would be awesome to have touch support in this library.

Multiple Resize-Handles

Hi,

is it possible to show more than one Resize Handle? I would also like to have a handle on the bottom-left side, so that the User can decide where he wants to resize his widget.

Thanks

PS: I think i wrote this into the wrong section. Sorry :/

Disable Drag & Resize

Hello, please could you tell me is it possible to disable drag&resize , and if it is, explain me how? Thank you.
RE: node.el.resizable('enable') & node.el.draggable('disable');

Max Height of Infinity

Would be nice if (like other options), max height could be set to 0 for infinity (and should likely be the default instead of 100.

Doing #41 would make this possible performance wise.

Gridstack and require.js

Hi,

is there a way to integrate this with Require.js and load it as an AMD module?

Thanks,
Nick

remove_all removes place holder and it is never readded

Seems as though the remove_all node methods also removes the place holder and it is never added back. If i remove_all and then add a new set of widgets, the place holder is gone. Is this a bug or how is remove_all supposed to be used?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.