Yii Framework Forum: Problems With Jquerys - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Problems With Jquerys Rate Topic: -----

#1 User is offline   paapi 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 28
  • Joined: 06-August 13
  • Location:chennai

Posted 14 November 2013 - 04:00 AM

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?
0

#2 User is offline   chandran 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 488
  • Joined: 08-October 12
  • Location:Austria

Posted 14 November 2013 - 04:10 AM

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');?>
Thanks
chandran nepolean

My own extension:
http://www.yiiframew...sion/ejqueryte/

My wiki
http://www.yiiframew...checkboxcolumn/

If it work dont hesitate to click +1 button
0

#3 User is offline   ORey 

  • Elite Member
  • PipPipPipPipPip
  • Yii
  • Group: Members
  • Posts: 1,688
  • Joined: 20-April 09
  • Location:Moscow, Russia

Posted 14 November 2013 - 04:11 AM

You can use registerCoreScriptScript (or registerScriptFile) instead of including <script src=""> directly.
God is real unless declared as integer
0

#4 User is offline   paapi 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 28
  • Joined: 06-August 13
  • Location:chennai

Posted 14 November 2013 - 09:03 AM

View Postchandran, on 14 November 2013 - 04:10 AM, said:

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');?>



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.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users