hootsuite / grid

Drag and drop library for two-dimensional, resizable and responsive lists
http://hootsuite.github.io/grid/
Apache License 2.0
3.57k stars 279 forks source link

Move items programmatically? #78

Open Busata opened 8 years ago

Busata commented 8 years ago

Hello,

We bumped into this plugin after checking out gridster & coming to the same conclusion that's unmaintained & thus not really reliable.

I was creating a small POC using this plugin, but was wondering if we can move items programmatically out of the box? I notice the gridclass has the functionality, but not sure if we can call it directly through the jquery functionality?

NiGhTTraX commented 8 years ago

You can access the grid instance through $('#grid').data('_gridList').gridList and there you can find the moveItemToPosition method. You'll need to trigger a re-render after you've changed the items by calling $('#grid').gridList('render').

That's just the unsupported peaking-at-internals way of doing it.