Drag and Drop with jQuery
Hi, I have implemented a Drag and Drop effect with jQuery. To make it easier, I read a list of elements from the database, these elements can be moved into a different folder. The Folders show the amount of Elements. Here you see my Folders: li id=\{$value['Cookbook']['id']}\span id=\countFav\{$amount} /span span{$value['Cookbook']['cookbookname']}/span/li; Everything works fine so far, but now I also wanted to make sure that the amount of Elements get updated. so I need to update the $amount. So what I figured out is that with this line of code I can overwrite my HTML with the ID in my case amount $.post('../dropZone', {cookbook_id: $(this).attr('id'),id:id}, function (data) { $(amount).html(data)}); But obviously if I do this the whole li dissapears and gets replaced with the AJAX response. Does anyone got an idea how I can just update the PHP variable $amount? Thank you very much in advance. Luke --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Drag and Drop with jQuery
Hi Jon, Great, this was the solution. Thank you so much for the help. Its the first time that I am using jQuery and I surley have to learn a lot more about it. I now only have one small issue left, where I am not 100% sure. I want that the Element I dropped dissapears when its dropped on a folder. I have actually taken the example from this page as the base: http://jqueryui.com/demos/droppable/#photo-manager So I suppose I have to add something in this area: // let the trash be droppable, accepting the gallery items $trash.droppable({ accept: '#gallery li', activeClass: 'ui-state-highlight', drop: function(ev, ui) { deleteImage(ui.draggable); } }); But I am really not sure, what would make the dropped element dissapear. Any hint on this aswell maybe? I have tried out different solutions, but never got anywhere. Do I have to somehow overwrite the class? Luke --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Drag and Drop with jQuery
hi Luke, Great, this was the solution. Thank you so much for the help. Its the first time that I am using jQuery and I surley have to learn a lot more about it. It's a great little framework, really is. I now only have one small issue left, where I am not 100% sure. I want that the Element I dropped dissapears when its dropped on a folder. All you need to do is call .hide('normal'); on the element and it will fade away. jb -- jon bennett w: http://www.jben.net/ iChat (AIM): jbendotnet Skype: jon-bennett --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Drag and Drop with jQuery
Hi Jon, It really is a very cool framework. I guess I was always trying to get around it since it looks complicated the first time you look at it and I was already busy enough picking up on OOP and now CakePHP. But you can't try to avoid it, since there would be too much to miss out. I thank you very much for your help, otherwise this would have been very frustrating I am now looking into the option you mention above, the call .hide ('normal'); on the element Unfortunately I thought that it would be just: $(ui.draggable).hide('normal'); but it is not, so I will have to play around a bit more with it. Thank you again. Luke --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---