Client Environment:
IE-7 or earlier.
(I don’t have a real IE-7. I tested with IE-Tester and IE-7 mode of IE-9)
Windows Vista 64-bit.
Symptom:
After the grid is updated by ajax, click on an ajax link in the grid will open a new window for the specified url.
How to reproduce:
-
Let gii generate some admin page.
-
Add 3 or 4 items.
-
Click "delete" button on one row.
-
Click "delete" button on another row.
Note:
You may notice nothing strange in the 3rd phase.
In the 4th phase, the original page behaves as expected, but another window will open for the link.
On-click event is processed as expected, but the opening of a new window happens before the event reaches the handler, so the call to “event.preventDefault()” doesn’t help in this.
I don’t call it a BUG either in Yii or in jQuery. I really hate IE-7’s weird script engine.
In short, jQuery.on() seems not working as expected in IE-7 …
workaround
Use ‘afterAjaxUpdate’ function, in which you first call jquery.off() to remove event handlers, and then call jquery.on() to re-attach event handlers.
You can move this topic to another forum.
I don’t think it’s an issue that Yii developers should give their time.