Save a re-ordered list with Jquery Sortable to DB [SOLVED] |
[eluser]Ludovic-r[/eluser]
Yes, I've done exactly what you said, the list isn't be draggable anymore. If I replace with the last js code it works but with no result in the DB. With firebug I have : order item[]=174&item;[]=171&item;[]=175 (in the POST) and still : Debugging Total items sent: 1 UPDATE `ft_upload_data` SET `id` = NULL, `order` = 0 WHERE `id` IS NULL
[eluser]eoinmcg[/eluser]
i've created a small proof of concept script here: https://gist.github.com/735918 you'll still need to hook it into your codeigniter app, but hopefully it'll give you an idea of where you're going wrong.
[eluser]Ludovic-r[/eluser]
Okay! I found the problem : It works perfectly when you put the JS Script in the Header (with DB, controller and so on...) BUT in my case I put the js in a file called main.js so I don't use the $(document).ready(function () {...}); and because of that it doesn't work! Have you a trick to use the JS script in a separated file (main.js for me) or use the $(document).ready(function () {...}); in this one? I can't put the "sortable" function in my header! Otherwise I would like to thank you sooooo much for your time that's really really helpful! You're the man!
[eluser]eoinmcg[/eluser]
i always use external files for my js; keeps thing clean and tidy. there's nothing stopping you wrapping your jquery snippets in main.js with the $(document).ready(function () {...});
[eluser]Ludovic-r[/eluser]
Argh, I feel stupid now... It works! Great! you've helped me a lot! SOLVED!
[eluser]lduarte[/eluser]
ok, i have the javascript code working, but i need like a submit button? to send the data to my controller?
[eluser]lduarte[/eluser]
sory, it´s working. but not in internet explorer! can anyone help?
[eluser]eoinmcg[/eluser]
hi, what problem are you getting? sortable works fine for me across multiple versions of ie
[eluser]lduarte[/eluser]
i add this [removed] if (typeof console == "undefined") { this.console = {log: function() {}}; } [removed] and workd fine now! thank you |
Welcome Guest, Not a member yet? Register Sign In |