Yii Framework Forum: Problems With Clientscript Registerscript - Yii Framework Forum

Jump to content

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

Problems With Clientscript Registerscript Rate Topic: -----

#1 User is offline   Anand S 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 22-January 13

Posted 22 January 2013 - 08:41 AM


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?


#2 User is offline   softark 

  • Keep It Simple
  • Yii
  • Group: Moderators
  • Posts: 3,630
  • Joined: 16-February 11
  • Location:Japan

Posted 22 January 2013 - 11:53 AM

/* Moved from "Bug Discussions" to "General Discussion for Yii 1.1.x" */

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