'Cannot read property 'ajaxType' of un

2019-08-20 06:38发布

Got following error: "Uncaught TypeError: Cannot read property 'ajaxType' of undefined". Here's my js code

 $('document').ready(
    function () {
       $.fn.yiiGridView.update('new-orders');
                });

What's interesting, when I'm not calling this function on document.ready, but waiting for page to load and calling it from console, everything works fine. but when I'm calling this in code, this error appears, and then when I'm trying to call it from console again, I'm receiving same error. Here's my widget code

<?php $this->widget('booster.widgets.TbGridView', array(
                'type'=>'striped bordered condensed',
                'ajaxUrl'=>array('/user/profile'),
                'dataProvider'=>$data,
                'id'=>'new-orders',
                'columns'=>array(
                      ....
                )));

1条回答
Deceive 欺骗
2楼-- · 2019-08-20 07:09

I have no idea about this framework but perhaps it's an asset issue. You can try using instead:

$(window).on("load", function() {
  $.fn.yiiGridView.update('new-orders');
});

Don't forget to read .ready()'s documentation about the usage of this event and you might want to have a closer look at your assets.

查看更多
登录 后发表回答