I'm using Mootools Sortables to sort a list, and i'm serializing the data and using a modifier so that the data is a bit more useful. This is开发者_StackOverflow社区 my code
var order = mySortableTable.serialize(0, function(element, index){
return 'item=' + index;
}).join('&');
This should return "item=0&item=2&item=1" depending on the order of the list (obviously the label "item" is not very useful but I will replace it when I get the function working).
This isn't working as wanted, all that is returned is "0&2&1" with no item label. This code is taken straight from the Mootools documentation so it should work but it doesn't. Anyone know why this isn't working as it should?
Help is much appreciated!
I've serialized a Mootools Sortables before, and I see no mistake in your code.
Could you give us more context? For example, the way you create your Sortables object...
Also important is how you identify the elements inside the Sortables.
UPDATE:
Thanks to the new information you gave us, I built a JsFiddle with a simplified version of your Javascript, and everything works as you need. You can use it as a basis to update your code and find out why it is not working. I tested it in Firefox 3.6.15 and Chrome 10.648 in Linux.
精彩评论