First off, Let me say how easy Yii has made my development. I no longer am worried about the "nitty gritty" and can rest assured that my code is also scalable (as long as I stick to proper code conventions ofcourse). Yii FTW!
Anyways, I have always had a problem with the below scenario. I have a page that registers all the scripts that it uses to the ClientScript object. This page has a base pagination (a custom CListView). All the operations on the pagination work perfectly.
My requirement is that once I click on an item of the pagination, it has to load another pagination via ajax. Here’s where the problem starts. The initial view of the secondary pagination loads properly, but its ajax buttons (next, previous, sort etc) do not work. Clicking on them reloads the entire page instead of sending an ajax request. On further digging, I found out that the CListView has a registerScripts method where it uses the options passed to it to render a jQuery - Some thing like
$cs->registerScript(__CLASS__ . '#' . $id, "jQuery('#$id').yiiListView($options);"
What I did is that I var dumped this script, and added it to the page dynamically using Firebug console, and lo! the buttons started sending out ajax requests, just like I wanted them to.I var_dumped the content of the clientScript objects on my page and the ajax response and they were different, in the sense they did not contain the script files that were loaded by the page.
Can anyone tell me what I am doing wrong?