jQuery的JTable中如何拖行(jQuery JTable how to drag rows)

2019-10-19 06:16发布

我想拖动表格构建与jQuery的JTable行,在版本更新排序顺序,但AJAX调用。 那可能吗?

找不到有关拖动任何行

Answer 1:

我发现了一个解决方案结合上recordsLoaded查询的UI,调用每个时间记录是加载

   $('#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();

        }
    });


文章来源: jQuery JTable how to drag rows