Page 1 of 1
Drag and Drop Grid
Posted: Wed May 07, 2008 8:29 am
by psurrena
I'm looking to build a program that lets a user drag and drop icons onto a grid. The icons represent people and the grid is career related. I'm thinking the "people" would be pulled from my existing database. My big question is, in PHP is there a way to save this information? Would it be better done in Flash?
What would need to be saved is, what icon is in what location on the grid. The location could just be div boxes.
Could this be written back to a database or better stored in XML? Can this even be done??
My goal is people could create their own layouts and then go back to them or show them to others.
Re: Drag and Drop Grid
Posted: Wed May 07, 2008 10:35 am
by pickle
The jQuery UI library was just released - included in it is a way to make anything draggable, but force it to move along a grid - you might be able to implement that some way.
Re: Drag and Drop Grid
Posted: Wed May 07, 2008 10:39 am
by psurrena
Great, I'll check it out. I guess the big issue is grabbing to coordinates. Anyone know if that's possible?
Re: Drag and Drop Grid
Posted: Wed May 07, 2008 10:53 am
by pickle
Trying not to be a jQuery whore here, but it's what I know...
Part of the jQuery UI library is dedicated to droppables. It'd be pretty straightforward (once one gets their head around it), to set up a grid of divs with ids denoting their grid location (1-1, 1-2, 1-3, 2-1, 2-2, etc). When an item is dropped on a div, you then know which item is in which location. You can then use AJAX to store that location, or use JS to store that information in hidden form fields, then post a form later, or some other solution I haven't thought of.
Re: Drag and Drop Grid
Posted: Wed May 07, 2008 1:23 pm
by psurrena
That's perfect, thanks so much!
Re: Drag and Drop Grid
Posted: Wed May 07, 2008 2:06 pm
by Christopher
You might also look at the Ext library. It sits on top of lower level Javascript libraries and provides a lot of higher level functionality.
Re: Drag and Drop Grid
Posted: Thu May 08, 2008 7:25 am
by arjan.top
unless your app is GPL stay away from ext (you must pay for commercial use)
Re: Drag and Drop Grid
Posted: Thu May 08, 2008 7:59 am
by psurrena
I will play with jQuery, it seems within my (mental) grasp right now.
Re: Drag and Drop Grid
Posted: Thu May 08, 2008 10:28 am
by Kieran Huggins
don't be afraid to use tables when they're appropriate!