dongse7261 2014-10-01 04:28
浏览 43
已采纳

更新后无法拖动Yii CGridview行

I am using below link for sorting CGridview row,

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

its working fine, but after grid update i cannot able to drag the grid row !

My code,

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

I have column 'order' after row dragged its gets updated, after grid refresh only updated value will be seen, so i need to update grid badly, can anyone say how to do this?

  • 写回答

1条回答 默认 最新

  • douxian9706 2014-12-08 19:01
    关注

    I think I know what the problem is. If you have any javascript or CSS added to the view where your grid lives, they may not be available after the ajaxUpdate. I suggest you re-activate the plugins or extra JS functionality used for drag'n'drop.

    For Example, if you want to use bootstrap tooltips you need to re-activate them after the ajaxUpdate:

    'afterAjaxUpdate' => 'function(id,data) { $("[rel=\"tooltip\"]").tooltip(); }',
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记