【问题标题】:Cannot drag Yii CGridview row after update更新后无法拖动 Yii CGridview 行
【发布时间】:2014-10-01 04:28:36
【问题描述】:

我正在使用下面的链接对 CGridview 行进行排序,

http://www.yiiframework.com/wiki/238/creating-a-jqueryui-sortable-cgridview/

它工作正常,但网格更新后我无法拖动网格行!

我的代码,

$('#basefilter-grid table').sortable({
            forcePlaceholderSize: true,
            forceHelperSize: true,
            items: 'tr',
            update : function () {
                serial = $('#basefilter-grid table').sortable('serialize', {key: 'order[]', attribute: 'class'});
                $.ajax({
                    'url': '" . $this->createUrl('baseContact/orderFilterRow') . "',
                    'type': 'post',
                    'data': serial,
                    'success': function(data){

                          $.fn.yiiGridView.update('basefilter-grid');

                    },
                    'error': function(request, status, error){
                        alert('We are unable to set the sort order at this time.  Please try again in a few minutes.');
                    }
                });
            },
            helper: fixHelper
        }).disableSelection();

在行拖动后我有列'order'被更新,在网格刷新后只会看到更新的值,所以我需要严重更新网格,有人能说怎么做吗?

【问题讨论】:

  • 您的浏览器控制台日志中是否有任何错误?
  • 没有错误,只是我不能在网格更新后拖动网格行!! !

标签: php yii jquery-ui-sortable cgridview


【解决方案1】:

我想我知道问题出在哪里。如果您在网格所在的视图中添加了任何 javascript 或 CSS,它们可能在 ajaxUpdate 之后不可用。我建议您重新激活用于拖放的插件或额外的 JS 功能。

例如,如果您想使用引导工具提示,则需要在 ajaxUpdate 之后重新激活它们:

'afterAjaxUpdate' => 'function(id,data) { $("[rel=\"tooltip\"]").tooltip(); }',

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-12-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-04-10
    • 1970-01-01
    相关资源
    最近更新 更多