1

次の jquery プラグインhttps://github.com/DubFriend/jquery.repeaterを使用して、繰り返し可能な入力フィールドをフォームに作成しています。また、jquery ソート可能プラグインによる要素の並べ替えのサポートも追加しました。繰り返し可能な要素のインデックス作成が台無しになっていることを除いて、すべてが正常に機能しています。

リピーター プラグインのドキュメントを読むと、インデックスhttps://github.com/DubFriend/jquery.repeater/issues/9をリセットする方法があることがわかりますが、ドラッグ後に機能をトリガーする方法がわかりませんドロップします。誰かが私にそれを行う方法を提案できますか?

これは私のソート可能なコードです

jQuery(".repeater-table").sortable({
    axis: "y",
    cursor: 'pointer',
    opacity: 0.5,
    placeholder: "row-dragging",
    delay: 150,
    handle: ".sort-option",
    update: function(event, ui) {
        // stuff to do on sorting update.
    }

}).disableSelection();

そしてこれがリピーターコードです。

jQuery('.wpumcf-field-repeater-options').repeater({
    show: function() {
        jQuery(this).slideDown();

        jQuery('.repeater-wrapper').animate({
            scrollTop: jQuery('.repeater-table').height()
        }, 300);
    },
    hide: function(deleteElement) {
        if (confirm(wpum_admin_js.confirm)) {
            jQuery(this).slideUp(deleteElement);
        }
    },
    ready: function(setIndexes) {
        $dragAndDrop.on('drop', setIndexes);
    },
    isFirstItemUndeletable: true
});

リセットをトリガーする方法を知っている人はいますか?

4

2 に答える 2

0

リピーターの「準備完了」機能で使用できる回避策は次のとおりです。

ready: function (setIndexes) {
    $(".repeater-table").mouseup(function(){
        setIndexes();
    });
},
于 2021-06-10T13:15:04.840 に答える