【发布时间】:2011-02-11 16:25:04
【问题描述】:
关于jQuery UI Nested Sortable 1.2.1的另一个问题。
我们这样调用函数:
$(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'
});
我在想如何通过这个发送更多信息,例如:
$(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'
});
想法是在toArray函数中按以下方式使用left_val、root_id和holder这三个变量。
var left = this.left_val;
var root_id = this.root_id;
这当然行不通。值以 NaN、NaN 和未定义的形式出现。
在var left = this.left_val; var root_id = this.root_id; 下方执行alert(left+' '+root_id); 会提示我undefined undefined
options的选项来自parent plugin jQuery UI。
只是想知道是否有人可以对此有所了解。
编辑:
我尝试了一个不同的技巧。我尝试通过<ol class="sortable" title="<?=$lft?>|<?=$id?>">发送left和root_id值,然后在js页面中,我尝试了
if ($(this).parent().attr('class') == 'sortable') {
var idArray = $(this).parent().attr('title').split("|");
}
但我收到$(this).parent().attr('class') 和undefined 的警告。
【问题讨论】:
标签: jquery-ui jquery-ui-sortable