CGridView update

Hi!

I have JsTree :


<? $this->Widget('application.extensions.jsTree.CjsTree', array(

  'data'=>$folders,

  'ui'=>array('theme_name'=>'default'),

  'id'=>'folders',

  'rules'=>array(

    'droppable' => "tree-drop",

    'multiple' => true,

    'deletable' => "all",

    'draggable' => "all" 

  ),

  'callback'=>array(

.....

    "ondblclk"=>"js:function(NODE, TREE_OBJ) { refreshFilesGrid(NODE); }",

.....

  ),

)); ?>

And I have GridView :


<?

$this->widget('zii.widgets.grid.CGridView', array(

    'id'=>'files-grid',

    'dataProvider'=>$files,

    'ajaxUpdate'=>true,

    'columns'=>array(

        array(

            'name'=>Yii::t('main', 'File name'),

            'value'=>'$data->name',

        ),

        array(

            'name'=>Yii::t('main', 'Date'),

            'value'=>'date("d-m-Y H:i:s", $data->uploaded)',

        ),

        array(

          'class'=>'CButtonColumn',

          'buttons'=>array(

            'update'=>array(

              'visible'=>'false'

              )

            )

        ),

    ),

));

?>

And refreshFilesGrid function :


<script type="text/javascript">

  function refreshFilesGrid(node)

  {

// Here is an javascript error showing: "$.param.querystring is not a function".

    $.fn.yiiGridView.update('files-grid', {

      type:'POST',

      url: 'ajax/getfiles/?folder_id'+node.id,

      success:function() {

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

      }

    });

  }

</script>

When I double clicking on tree node I need refresh gridview. How to do it?

Thanks.

Tried to bind click to links in tree :


Yii::app()->clientScript->registerScript('xxx', "

$(\"a[href='#']\").click(function() {

  $.fn.yiiGridView.update('files-grid', {

    type:'POST',

    url:'/ajax/test',

    success:function() {

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

    },

    failure:function() {

      alert('error');

    }

  });

  return false;

});

");

…but error ‘$.param.querystring is not a function’ still showing :(

$.param.querystring is called from the yiiGridView.update and is located in the jquery.ba-bbq.js

check your HTML source if you have the jquery.ba-bbq.js included…

1 Like

that’s it , thank you very much !

Seems reed1 has solved his issue. I have exactly same error and I’ve tried blocking and enabling “jquery.ba-bbq.js” and still the error presists.

If the jquery.ba-bbq.js is included then you may recreating the jQuery object after jquery.ba-bbq.js. E.g. jQuery is loaded more than once…

Muchas Gracias! también tenia problemas con esto!

Suggestion:

  1. Use chrome ctl + shift + I to debug and find the indeed error message

  2. check if related javascript are loaded

  3. check if the javascript files are loaded in right order

if you want to know how to use chrome for debugging, you can read how to debug Yii 400 Error using Chrome

thank you ,

but why wont Yii register the js file automatic ??!?!