简体   繁体   English

无法调用未定义的Cgridcview的方法“更新”

[英]Cannot call method 'update' of undefined Cgridcview

$.fn.yiiGridView.update('sopodetail-grid'+itemcd); this function it's not running. 此功能未运行。

It says Cannot call method 'update' of undefined in console. 它说Cannot call method 'update' of undefined在控制台中Cannot call method 'update' of undefined

I have problem when inserting data via ajax gridview not refreshing. 通过ajax gridview插入数据时,我没有刷新的问题。

I render multiple grid view with foreach looping, and make each of them unique id with concatenating item_cd . 我使用foreach循环渲染多个网格视图,并通过串联item_cd使它们每个都具有唯一的ID。

 function validateDetailForm()
    {
        var jForm   = $('#sopodetail-form');                                                    
        var data    = jForm.serialize();
        var itemcd  = $('#cmbitemcd').val();

        $.ajax({
            type: 'POST',
            url : jForm.attr('action'),
            data: data,
            dataType:'html',
            success:function(data) 
            {

                $(".info").animate({opacity: 1.0}, 3000).fadeOut("slow");
                $.fn.yiiGridView.update('sopodetail-grid'+itemcd);
            },
            error: function(data) { // if error occured
                alert('Error occured.please try again');
                $('#detail-content').html(data);
            },
        });
    }

this how i can render multiple gridview i concating the id... 这就是我可以渲染多个gridview我的ID ...

foreach($modelSoDet as $modelSoDetObj):
    $this->widget('zii.widgets.CDetailView', array(
            'data'=>$modelSoDetObj,
            'attributes'=>array(
                'item_cd',
                'item.item_name',
                'item.item_desc',
                'qty',
                'qty_purchased'
            )
    ));

    $modelSoPoDetail = new Sopodetail();
    $modelSoPoDetail->unsetAttributes();
    $modelSoPoDetail->so_cd   = $modelSoDetObj->so_cd;
    $modelSoPoDetail->item_cd = $modelSoDetObj->item_cd;
    $gridid           = 'sopodetail-grid'.$modelSoPoDetail->item_cd; 

    $this->widget('zii.widgets.grid.CGridView', array(
            'dataProvider'=>$modelSoPoDetail->search(),
            'summaryText' => '',
            'id'=>$gridid,
            'columns'=>array(
                'type',
                'po_cd',
                'qty'
            )
    ));
            endforeach;

您应该简单地尝试使用正确的语法:

$('sopodetail-grid'+itemcd).yiiGridView('update');

$.param.querystring is called from the yiiGridView.update and is located in the jquery.ba-bbq.js . $.param.querystring从所谓yiiGridView.update和位于jquery.ba-bbq.js

check your HTML source if you have the jquery.ba-bbq.js included... 检查您的HTML源代码是否包含jquery.ba-bbq.js ...

If the jquery.ba-bbq.js is included then you may be recreating the jQuery object after jquery.ba-bbq.js . 如果包括了jquery.ba-bbq.js ,那么您可能在jquery.ba-bbq.js之后重新创建jQuery对象。 Eg jQuery is loaded more than once.... 例如,jQuery已加载多次。

Source: http://www.yiiframework.com/forum/index.php/topic/9387-cgridview-update/ 资料来源: http : //www.yiiframework.com/forum/index.php/topic/9387-cgridview-update/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM