This is my first use of nestedsortable.js in a custom cms creation with codeigniter, So I use it with Codeigniter php framework. I have an ordered and nested list(for order pages) and I need to convert this list to array with 'toArray' but it's not working the error message: uncaught typeError: Cannot call method 'match' of undefined this is my js code:
<script>
$(document).ready(function(){
$.post('<?=base_url("index.php/admin/pages/order_ajax"); ?>',{},function(data){
$('#orderResult').html(data);
});
$('#save').click(function(){
oSortable = $('.sortable').nestedSortable('toArray');
$.post('<?=base_url("index.php/admin/pages/order_ajax"); ?>',{sortable:oSortable},function(data){
$('#orderResult').html(data);
});
});
});
except that everything is good, so I need your help
This is my first use of nestedsortable.js in a custom cms creation with codeigniter, So I use it with Codeigniter php framework. I have an ordered and nested list(for order pages) and I need to convert this list to array with 'toArray' but it's not working the error message: uncaught typeError: Cannot call method 'match' of undefined this is my js code:
<script>
$(document).ready(function(){
$.post('<?=base_url("index.php/admin/pages/order_ajax"); ?>',{},function(data){
$('#orderResult').html(data);
});
$('#save').click(function(){
oSortable = $('.sortable').nestedSortable('toArray');
$.post('<?=base_url("index.php/admin/pages/order_ajax"); ?>',{sortable:oSortable},function(data){
$('#orderResult').html(data);
});
});
});
except that everything is good, so I need your help
Share Improve this question asked Sep 25, 2013 at 9:40 user2814542user2814542 112 bronze badges 3-
Couldn't you use:
oSortable = $('.sortable').get();
– A. Wolff Commented Sep 25, 2013 at 9:44 - not working, the toarray get the list as a nested array.I need this array to continue the other proccesses – user2814542 Commented Sep 25, 2013 at 10:25
- 1 Maybe you should provide what you get and what you expect to get... – A. Wolff Commented Sep 25, 2013 at 10:29
1 Answer
Reset to default 9I had the same problem. The solution is simple. You need set id for your li elements.
<li id="list_1"> etc...
Because without a set id, element returns "undefined" and it throws an error. Function "match" needs string.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745090723a4610679.html
评论列表(0条)