paulferree Posted August 14, 2008 Share Posted August 14, 2008 Hello, I'm trying to create a sort order for a menu system without using simple input boxes with numbers. I think what's practical is Arrow ordering, however, I would love to incorporate some kind of drag and drop system. Know of anything that can do that and cooperate with a MySQL db without too much crazy coding. As far as the arrow ordering...I want to make sure I'm not over analyzing the issue. So can someone help me with the concept? Basically...as I see it. -When a user clicks on an "up" arrow for instance. A URL variable is sent and notifies the script that we're doing a sort order change. -The script then finds the current position of the menu item. -It will set the current position to [current position - 1] -Next I have to add 1 to every other menu item's sort order that is "behind" it. Sounds a little long hand...but that's how I see it in my head...anything better, or even an online tutorial? Thanks, Paul Link to comment https://forums.phpfreaks.com/topic/119692-menu-ordering-arrow-or-drag-and-drop/ Share on other sites More sharing options...
lemmin Posted August 14, 2008 Share Posted August 14, 2008 Does it need to be updated after ever change or can the user switch the items around and then submit the new order? Link to comment https://forums.phpfreaks.com/topic/119692-menu-ordering-arrow-or-drag-and-drop/#findComment-616649 Share on other sites More sharing options...
paulferree Posted August 14, 2008 Author Share Posted August 14, 2008 I think the preferable method is make all ordering changes and then submit it, updating all sort orders. Thanks, Paul Link to comment https://forums.phpfreaks.com/topic/119692-menu-ordering-arrow-or-drag-and-drop/#findComment-616669 Share on other sites More sharing options...
lemmin Posted August 14, 2008 Share Posted August 14, 2008 How is the order stored in the DB? Does each entry have a position? Link to comment https://forums.phpfreaks.com/topic/119692-menu-ordering-arrow-or-drag-and-drop/#findComment-616719 Share on other sites More sharing options...
paulferree Posted August 14, 2008 Author Share Posted August 14, 2008 Each id has a column for "sortorder" which will determine the placement on a page. Link to comment https://forums.phpfreaks.com/topic/119692-menu-ordering-arrow-or-drag-and-drop/#findComment-616755 Share on other sites More sharing options...
lemmin Posted August 14, 2008 Share Posted August 14, 2008 You could submit the list in order and then just update every id that was there. Depending on how many items are in the list it might not be too efficient, but if an item is moved to the top of the list you have to do that anyway. Link to comment https://forums.phpfreaks.com/topic/119692-menu-ordering-arrow-or-drag-and-drop/#findComment-616775 Share on other sites More sharing options...
paulferree Posted August 14, 2008 Author Share Posted August 14, 2008 Yeah but I either have to use input boxes, which I don't want to use. Or find some kind of function that allows me to drag and drop items without refreshing the page. hmmm.... thanks for your ideas Paul Link to comment https://forums.phpfreaks.com/topic/119692-menu-ordering-arrow-or-drag-and-drop/#findComment-616781 Share on other sites More sharing options...
paulferree Posted August 16, 2008 Author Share Posted August 16, 2008 Well, I found a solution and it's pretty slick if you can get it to work...it didn't work well for me "out of the box" and I had to do a few more tricks to make it write to the database correctly. But, I have it working 100% now and I love it. But here it is: http://www.gregphoto.net/sortable/ Paul Link to comment https://forums.phpfreaks.com/topic/119692-menu-ordering-arrow-or-drag-and-drop/#findComment-617751 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.