How To Renderpartially With Fancybox 1.3

Hi,

I have this view (project assignment) where a user can associate a person with a project. So imagine 2 drop downs, 1 for the person name and 1 for the project name. On save, create a record in the db.

But if the person record does not exist in the db, then there will be a link "Add a person" on the view.

I want, on click, display the create person view in fancybox. On close, refresh project assignement view.

My problem is that i am not sure how i can renderPartial the person/create view. Something like:


CHtml::link(yii:t('app','Create a new person'), (RENDERPARTIAL) Yii::app->createUrl('person/create'), array......

Is there a way?

Your controller is in charge of rendering the view partially or otherwise. The easiest way is perhaps to check if the request has been performed over ajax, and just render partial in that case.




if (Yii::app()->request->isAjaxRequest)

    $this->renderPartial(...);

else

    $this->render(...);



Alternatively, you could pass an optional parameter in your ajax request and base the decision in the controller on the presence of the parameter.