I try to debug a javascript code which is called from a view which is called by renderpartial function. However, my breakpoints in the javascript file are useless since yii transforms the js code to a file VMXXX and makes the function call to this file. I can see it from the call stack.
Does anyone know how to debug javascript code called from a partially rendered view php?
Actually I debug it in Chrome Developer Toolkit. My problem is when I set a breakpoint in the JS file. It is invalid since yii uses it’s own transformed js file. This is caused by renderpartial. I know because when I call the view directly with url ?r=site/ControllerAction, it includes the original JS file.
$this->renderPartial(‘processdetails’, array(), false, true); //this is the view php file.
All works great. The result is as I expected. JS is included and initEAProjects() function is executed.
However when I set a breakpoint inside the initEAProjects() function, the execution does not break, although it does when I use render instead of renderpartial.
My guess is that you are loading EABlueprint.js multiple times, again and again with each ajax call. So the code that you have set a break point will not be called after an ajax, but the same code newly loaded will be called instead.
Do you really have to load the script in every ajax response? Maybe no, I guess.
Consider using registerScriptFile, then you can load the script just once in the initial page load.