cos-archives / hgrid

[UNMAINTAINED] A Javascript-based hierarchical grid that can be used to manage and organize file/folder-like data
Apache License 2.0
23 stars 14 forks source link

[Draggable] Option to not modify the grid directly #69

Closed brianjgeiger closed 10 years ago

brianjgeiger commented 10 years ago

The draggable plugin is currently moving things whenever they are dropped. I need to update this based on info we get back from the server. The biggest problem is sometimes things are being copied and not moved, and they shouldn't be removed from the original folder.

brianjgeiger commented 10 years ago

I may be able to work around this on my side, as I have to reload all the data in any case, though it might look a bit odd depending.

brianjgeiger commented 10 years ago

It doesn't look like I can easily work around this; I don't have easy access to the grid when I'm responding to the onDrop event, so when the data changes under me, I have a tough time reloading the proper folders. Ideally, if we are lazy-loading anyways, it should lazy-load the appropriate folders once the drop events are handled rather than directly manipulating the data. Failing that, letting me have an option to not modify the grid and letting me handle it all would be great.

sloria commented 10 years ago

As of 87306cf, HGrid.Draggable objects (and all plugins henceforth) have access to their HGrid through their grid attribute.

Will this be enough for your needs, or will you still need an option to prevent the grid manipulation?

brianjgeiger commented 10 years ago

It will probably be enough, but I'll need to try it out to be sure.

brianjgeiger commented 10 years ago

I have it working, but it will be inefficient if someone copies something out of a folder with many items, such as the 'All My Projects' smart folder, because I have to reload it in order to get the item back that was removed as part of the drag. If I don't have to reload, then it looks better and, in the case of a large smart folder, will save a lot of time.

brianjgeiger commented 10 years ago

It doesn't look right as is. It would be really great to be able to optionally disable this functionality. But it does work consistently now.

sloria commented 10 years ago

Added a temporary enableMove flag that will take of this