Welcome Guest, Not a member yet? Register   Sign In
Save a re-ordered list with Jquery Sortable to DB [SOLVED]
#11

[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
#12

[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.
#13

[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!
#14

[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 () {...});
#15

[eluser]Ludovic-r[/eluser]
Yeah, I tried that but it don't work
#16

[eluser]Ludovic-r[/eluser]
Argh, I feel stupid now... It works!

Great! you've helped me a lot! SOLVED!
#17

[eluser]lduarte[/eluser]
ok, i have the javascript code working, but i need like a submit button? to send the data to my controller?
#18

[eluser]lduarte[/eluser]
sory, it´s working. but not in internet explorer! can anyone help?
#19

[eluser]eoinmcg[/eluser]
hi,

what problem are you getting?

sortable works fine for me across multiple versions of ie
#20

[eluser]lduarte[/eluser]
i add this

[removed]

if (typeof console == "undefined") {
this.console = {log: function() {}};
}

[removed]


and workd fine now! thank you




Theme © iAndrew 2016 - Forum software by © MyBB