Yii Framework Forum: JQuery + render partial + AJAX - Yii Framework Forum

Jump to content

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

JQuery + render partial + AJAX Rate Topic: -----

#1 User is offline   Stefanus 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 26
  • Joined: 31-March 10

Posted 07 July 2010 - 01:31 AM

Hello all.. I'm sorry if any answer which is answer my question below [ but i've tried to find an answer and still not yet find an answer ]

I have success to used JQuery to get the value of renderPartial View. But the problem is arise when i was change the content of renderPartial for example using ajax request ( which is i was made in JQuery) to load some new value from Database.

My new content of renderPartial can't used the JQuery script which I was made first !!

I don't know why the result view of renderPartial as if they can't know about JQuery i was made manully first ??

Is there any solution or explanation about this problem ?? [ I'm new in PHP, Yii + JQuery + AJAX ] I'm very appreciate all.. Thanks before

Stefanus
0

#2 User is offline   zaccaria 

  • Elite Member
  • PipPipPipPipPip
  • Yii
  • Group: Members
  • Posts: 2,232
  • Joined: 04-October 09
  • Location:Moscow

Posted 07 July 2010 - 03:22 AM

take a look to this thread
0

#3 User is offline   Stefanus 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 26
  • Joined: 31-March 10

Posted 07 July 2010 - 08:31 AM

View Postzaccaria, on 07 July 2010 - 03:22 AM, said:

take a look to this thread


Thanks zac.. but i still don't find a solution or summary exactly on those thread.
What i have aware probably are :

1. First , i call renderPartial in this form :
$this->renderPartial('view',array());
2. Second , I've tried second option to call renderPartial in this form :
$this->renderPartial('view',array(),false,true);

I've looked the different which is the second send back jquery.js script too.

But two of both still not answer my problem. I have a JQuery script that i wrote
Yii::app()->clientScript->registerScript('browse', " JQuery Script ");
in the main page ( view ). In those JQuery script i did ajax call and then run controller to run renderPartial to update <div> region in my main page (view), the result is success ,BUT the result CAN'T worked to use JQuery i wrote before in main page ??


Anyone can give me explanation or anything to solve this problem.

Thanks a lot before.. I'm very appreciate all


Stefanus
0

#4 User is offline   Stefanus 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 26
  • Joined: 31-March 10

Posted 07 July 2010 - 12:41 PM

Hello I'm sorry before , because i still confuse about this problem. I have tried another attemption to solved this problem.

I will tell about my real case in compact to give a graps :

Quote


1. I have a page said main page which is inisiate ajax call use JQuery ( where i did it in Yii::app()->clientScript->registerScript( ..... ).

2. I have : a. <input name="Name"> and CHtml::link() -> to call ajax request which is defined in ( no 1 ), SO when this link is clicked , it will request on controller to update region in no 2b below "PersonBrowser"
b. <div id="PersonBrowser"> region where i call renderPartial() to display a list of person in CGridView.

3. In ( no 1 ) location , i wrote JQuery statement to manipulate data in CGridView from (no 2b).


PROBLEMS ( I've made attemption ) :
1. In the first load of main page -> script in (no 3) can be used to manipulate data in CGridView. But after user clicked to link on (no 2a) , the result is displayed in region (no 2b) and script (no 3) can't be used again.

2. I SOLVED this problem with this ways:
I copy script in (no 3) which is used to manipulate data into [success] section on ajax call which is called when user clicked link (no 2a)

SO I have two of copy statement to manipulate data in GridView

BUT I still need an explanation for this case, and want to find better way to solve in elegant ways.




Sorry if my description confusing all you are, because my limitation in english.
I'm open from anything comment or critics about this post

Is there any suggestion, explanation, example, or summary ... I'm very appreciate it


Thanks a lot



stefanus
0

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