Problems With Jquerys

Hai Everyone,

I have to use a calender controller in my yii page.

So i got one jquery calender. "Datepicker"

Actually am displaying the page in a popup screen using




       echo $this->renderPartial('some',array(),true,true);



while doing the jquery displays calender in the popup.

But the problem is when am displaying the same action using




       $this->render('some',array());



I didn’t get the calender view in my page

I thought when am rendering a view it embedded within a layout. The layout may have some other jquery library that may cause the problem here.

I am not sure about that. Its just my conclusion for the problem.

How can i overcome this?

Hi,

you are right … there is a problem related to duplicate jquery loading

Just check whether duplicate jquery got loaded or jquery itself not loaded :)

To avoid duplicate issue

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

                'jquery.js'=>false,


                'jquery.ba-bbq.js'=>false,


                'jquery.yiigridview.js'=>false


            ); 

and calling this :)

$this->renderPartial($view, array(‘model’=>$model), true, false);

To load the basic jquery

<?php Yii::app()->clientScript->registerCoreScript(‘yii’);?>

<?php Yii::app()->clientScript->registerCoreScript(‘jquery’);?>

You can use registerCoreScriptScript (or registerScriptFile) instead of including <script src=""> directly.

Thanks for the reply

I have look into the source of my page for checking whether jquery is loaded or not.

First it not been loaded

Then As per your suggestion I tried these




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

                    'jquery.js'=>false,

                    'jquery.ba-bbq.js'=>false,

                    'jquery.yiigridview.js'=>false

                ); 


and 


<?php Yii::app()->clientScript->registerCoreScript('yii');?>

<?php Yii::app()->clientScript->registerCoreScript('jquery');?>

<?php Yii::app()->clientScript->registerCoreScript('jquery.ui');?>




it include the following files in my view




    <script type="text/javascript" src="/pyt/assets/7693be3/jquery.yii.js"></script>

    <script type="text/javascript" src="/pyt/assets/7693be3/jui/js/jquery-ui.min.js"></script>



Still i am not able to get the calender view.

Actually i getting the calender view in my popup screen.

It won’t work only with the layout only.

So I have tried to use NoConflict()




                    <script src="<?php echo Yii::app()->request->baseUrl;?>/js/design/jquery-ui.js"></script>

                    <script>

                       var jq = jQuery.noConflict();

                       jq(function() {

                       jq( "#datepicker" ).datepicker();

                       });

                    </script>

                    <div id="datepicker"></div>



That too not helpful. Even-though now also i am getting the exact calender view in popup screen of the same page.

Please Help me with this…

Thanks in advance.

paapi.