I have a two column view. The left view I want to render a CListView with links to the 2nd column which is sort of a detail view. For example:
// mainView.php
<div id="left">
<!-- render a list of people for instance -->
<?php $this->widget('zii.widgets.CListView', array('dataProvider'=>$dataProvider, 'itemView'=>'subView'));
</div>
<div id="right">
<?php $this->renderPartial('personDetail', array('model'=>$model)); ?>
</div>
This works fine to populate the right side with data until I sort or go to the next link… at which point the ajaxLink is broken and no longer works. I can’t find how the links are being broken. Is there a better way to approach this?
Looking it up in firebug I notice that once clicking on sorting or paging my links from the subView are no longer a url but just a “#”. But I don’t know why the subView isn’t updating the url’s properly… maybe ajaxLinks can’t be updated on a partial of the page since they need to add javascript to the end… can that be done manually?
Tried a static version by setting ajaxUpdate to false but…
Then it kills the contents on the right if you sort or click on another page of course. To get it to work like this you have to change your links to include paging and sorting parameters… but I can’t figure that out either… can that be done in the subView (need to get the paging and sorting params for links)? Otherwise clicking on a link in the subview will reset the contents on the left.
Any ideas on how to solve this… static or ajax? The difficult part is that this page is generated from a search of multiple fields (name, age, sex, race…), so those parameters have to be passed to the detail view (along with the sort and paging) in order to generate the correct url.
Thank you very much. I understood. When using CHtml::ajaxLink, javascript is appended at the bottom of page, so it is expried when a new part of page is loaded via ajax. If we declare javascript in onclick property, the problem is solved.