與jQuery UI Nested Sortable 1.2.1有關的另一個問題。jQuery UI嵌套可排序,發送附加數據
我們稱這樣的功能:
$(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'
});
想法是用三個變量,left_val,root_id並在toArray函數中以下列方式保存。當然,這是行不通的。價值觀以NaN,NaN和未定義的形式出現。
做一個alert(left+' '+root_id);
略低於var left = this.left_val; var root_id = this.root_id;
是給我一個警告,說明undefined undefined
選項的選項從parent plugin jQuery UI到來。
只是想知道是否有人可以投訴此事,請。
編輯:
我嘗試了不同的技巧。我試圖通過<ol class="sortable" title="<?=$lft?>|<?=$id?>">
發送左和root_id值,然後在JS頁面,我試圖
if ($(this).parent().attr('class') == 'sortable') {
var idArray = $(this).parent().attr('title').split("|");
}
但是我卻越來越$(this).parent().attr('class')
爲undefined
戒備狀態。
感謝凱爾。數據非常有趣。然而,根據[這個jQuery UI頁面](http://jqueryui.com/demos/sortable/#options),數據顯然不是可用選項的一部分。 – 2011-02-11 17:31:36