Model search() in CGridView problems

Hello,

I have been trying to make my model search() works in CGridView on my server, but it never works and the msg " $.param.querystring is not a function"

is always displayed on firebug. I already made sure that I have jquery.b-bbq.js included in framework and it doesn’t solve the problem.

Here is my action:


 

         public function actionTest(){

                   $newsModel = new News('search');

                     if(isset($_GET['News']))

                    $newsModel->attributes=$_GET['News'];


                     $this->render('mytest',array(

                         'testNewsModel'=>$newsModel,

                                         

                     ));

        }



My view code, mytest:





<?php

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

                               'dataProvider'=>$testNewsModel->search(),                              

                               'filter'=>$testNewsModel,

                               'columns'=>array(                              

                                   array(

                                       'name'=>'title',

                                       'type'=>'raw',

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

                                   ),

                                   array(

                                       'name'=>'body',

                                       'type'=>'raw',

                                       'value'=>'$data->body'

                                   )

                               ),

                               'enablePagination'=>true,

                               'enableSorting'=>true,

                               ));

?>




Though, similar code ( as : ../post/admin in blog ) works perfectly on the localhost.

I have been searching for the problem, but not found any talk matched to this kind of problem.

Anyone knows what causes this misbehavior ??

The file required is - jquery.ba-bbq.js (you wrote jquery.b-bbq.js, but it could be a typo)

And check that it’s included before the jquery.yiigridview.js

One more tip: try to delete all the content of the assets folder

I though yii automatically includes all required assets, why would he need to manually include bbq?

By default it does… but it can be prevented if someone decides to include it manually…

Opps!! Sorry for my typo. Yeah I already have included that jquery.ba-bbq.js and clear all the content of asset folder,but it still doesn’t work. :(

Any idea?

In fact I think the same as Asgaroth that only enabling filter in CGridView with model search()specified in property dataProvider, then search function should work fine by now.

I really do not get it why CGridView doesn’t work on server, but works well in localhost? Though, both use the same yii framework(library) directory Hmmmm!

In my case, it was a difference between jquery.js and jquery.min.js that caused a malfunction of CGridView on the production server.

While the CClientScript includes jquery.js if YII_DEBUG is defined, it will include jquery.min.js if YII_DEBUG is not defined.

This difference couldn’t be a problem when you are not including jquery.js by yourself.

Are you or not?

If you are, I think you should have set a scriptMap for jquery.js. Add a map for jquery.min.js too.




Yii::app()->getClientScript()->scriptMap = array(

	'jquery.js' => 'https://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js',

	'jquery.min.js' => 'https://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js',

);



Thanks for your suggestion, but I am not including jquery.js by myself throughout my application.

And from what you said you mean if I do disable the YII_DEBUG (specified in entry script) then jquery.min.js should be used instead of jquery.js right?

I tried but it does not work as well.

Please forget my post if you don’t include ‘jquery.js’ by yourself.

Yes.

In my case, 2 of the jqueries … ‘jquery.js’(which I myself specified) and ‘jquery.min.js’(which the CClientScript has selected) … were included in the HTML on the product server. And they caused the problem.

  1. ‘jquery.js’.

  2. ‘jquery.yiigridview.js’ and it add some function to jquery.

  3. ‘jquery.min.js’ and it throw away all the functions added by ‘jqeury.yiigridview.js’.

Thank you so much softask and mdomba,

Almost the whole week that I have been stuck. Many pages which have CGridView included couldn’t use search() on server , but now it works smoothly!

I found the core problems now eventually from the clues you guys have given me. Only the scope of google map script that messed things up and caused the collision between jQuery stuffs.

Really Appreciate your help. X^D