0

すみません、戻ってきました

「最後の」ソート可能なアイテムを取得するにはどうすればよいですか。あるリストから別のリストをドラッグしていますが、「ドロップ」リストの最後のアイテムではない可能性がある、最後にドラッグされたアイテムに「長さ」を追加する必要があります-ご理解いただければ幸いです。

コードのアイデア

    $j(function() {
        $j("#id_section_layout").sortable({
        connectWith: '.colunm,.layoutcolunm,#layoutbin',
        helper: 'clone',
        receive: function(event, ui) {
        $j("#id_section_layout .content_options").children().show();
        var val= $j("#id_section_layout .content_options").length;
// .. I want to append val to the LAST dragged/dropped item
//.. If I do this it is always to the "last" item in the list which may not be the last dragged item -
             $j("#id_section_layout .content_options").last().append(val);
//.. So is there a way to get the last dragged item?
        }
        });
});
4

1 に答える 1

1

receive使用できるハンドラー内には、関数が受け取るオブジェクトui.itemから利用できるいくつかの要素があります。ui

  • ui.helper - 現在のヘルパー要素 (ほとんどの場合、アイテムのクローン)
  • ui.position - ヘルパーの現在位置
  • ui.offset - ヘルパーの現在の絶対位置
  • ui.item - 現在ドラッグされている要素
  • ui.placeholder - プレースホルダー (定義した場合)
  • ui.sender - アイテムの出所であるソート可能 (接続されたリストから別のリストに移動した場合にのみ存在します)
于 2010-08-06T16:49:36.660 に答える