JaquelineBrandao / yii

Automatically exported from code.google.com/p/yii
0 stars 0 forks source link

CHhtml links and buttons don't work with ajax. #38

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

<div id="target">
<?php echo CHtml::ajaxLink("TestLink",
                array('site/updateTarget'),
                array('replace'=>'#target'),
                array('name'=>'testLink', 'confirm' => 'Are you sure?')
        ); ?>
</div>
Works only ones.

What is the expected output? What do you see instead?
Should work always.

What version of the product are you using? On what operating system?
SVN, tested on Gecko (Iceweasel) and KHTML (Koqueror) browsers.

Suggestion to solve:

in class CClientScript:
+ const POS_TAG=5;

in CHtml::clientChange($event,&$htmlOptions):

+if($htmlOptions['scriptPosition'] === CClientScript::POS_TAG)
+  $htmlOptions['on'.$event] = $handler;
+else 
    $cs->registerScript('Yii.CHtml.#'.$id,"jQuery('#$id').
$event(function(){{$handler}});");
+unset($htmlOptions['scriptPosition']);

Original issue reported on code.google.com by rb.pa...@gmail.com on 4 Dec 2008 at 4:01

GoogleCodeExporter commented 9 years ago
My scenario was binding Jquery fancyBok links to thumbnails in a clistview
The issue is that if clistview is ajax enabled, when an user requests another 
page of 
thumbnails, the thumbnails  come from ajax, so every script in the "parent" 
document does not know about them
so i have to fire an onAjaxComplete and bind fancybox to the newly received 
html elements.

Original comment by tudorili...@gmail.com on 23 Mar 2011 at 4:23

GoogleCodeExporter commented 9 years ago
Migrated to http://github.com/yiisoft/yii/issues/298

Original comment by qiang.xue on 15 Feb 2012 at 6:48