jQuery UI Nested Sortable, sending additional data -
another question relating jquery ui nested sortable 1.2.1.
we call function this:
$(document).ready(function(){ $('ol.sortable').nestedsortable({ disablenesting: 'no-nest', forceplaceholdersize: true, handle: 'div', items: 'li', opacity: .6, placeholder: 'placeholder', tabsize: 25, tolerance: 'pointer', toleranceelement: '> div' });
i thinking how can send additional information through this, like:
$(document).ready(function(){ $('ol.sortable').nestedsortable({ disablenesting: 'no-nest', forceplaceholdersize: true, handle: 'div', items: 'li', left_val: '<?=$lft?>', root_id: '<?=$id?>', opacity: .6, placeholder: 'placeholder', tabsize: 25, tolerance: 'pointer', toleranceelement: '> div' });
idea use 3 variables, left_val, root_id , holder in following fashion in toarray function.
var left = this.left_val; var root_id = this.root_id;
this not working, of course. values coming out nan, nan , undefined.
doing alert(left+' '+root_id);
below var left = this.left_val; var root_id = this.root_id;
giving me alert stating undefined undefined
the options of options coming parent plugin jquery ui.
just wondering if can throw light this, please.
edit:
i tried different trick. tried send left , root_id values through <ol class="sortable" title="<?=$lft?>|<?=$id?>">
, in js page, tried
if ($(this).parent().attr('class') == 'sortable') { var idarray = $(this).parent().attr('title').split("|"); }
but i'm getting $(this).parent().attr('class')
undefined
on alert.
have looked @ jquery.data() ? let store arbitrary data in key/value pairs element. jquery data() documentation
here more documentation link
Comments
Post a Comment