I would like to drag rows in a table build with jQuery jTable, on release update sort order with ajax call. Is that possible?

Can't find anything about draggable rows

有帮助吗?

解决方案

i found a solution bind the query ui on recordsLoaded, call each time record are loaded

   $('#mytable').jtable({
        title: 'my title',
        paging: true,
        pageSize: 100,
        sorting: true,
        defaultSorting: 'order ASC',
        selecting: true,
        multiselect: true,
        selectingCheckboxes: true,
        columnSelectable: false,
        gotoPageArea: 'none',
        pageSizeChangeArea: false,
        actions: {
            listAction: '../ajax/myajax.php'
        },
        fields: {
            id: {
                key: true,
                create: false,
                edit: false,
                list: false
            },
            order: {
                title: 'order',
                create: false,
                edit: false,
                sorting: false
            }
        },
        recordsLoaded: function () {

            $(".jtable tbody").sortable({
                cursor: 'move',
                opacity: 0.9,
                axis: 'y',
                start: function (event, ui) {
                    if ($.browser.webkit) {
                        wscrolltop = $(window).scrollTop(); // bug fix
                    }
                },
                sort: function (event, ui) {
                    if ($.browser.webkit) {
                        ui.helper.css({ 'top': ui.position.top + wscrolltop + 'px' });  // bug fix
                    }
                },
                update: function(event, ui) {

                    // do jquery HERE on sort

                }

            }).disableSelection();

        }
    });
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top