Yii Framework Forum: Fancybox Inside Listview Fails On Second Page - Yii Framework Forum

Jump to content

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

Fancybox Inside Listview Fails On Second Page

#1 User is offline   Collin 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 08-March 12

Posted 11 April 2013 - 03:22 PM

Hi everyone, I have a ListView on my models index page which contains multiple fancybox galleries - one per model. Each model is a portfolio, which contains 1 through N photos. The photos get their own fancybox gallery. Page 1 works great. Any other page loses the code. Basically the problem is that the fancybox javascript definitions are not being updated. Even though I'm using TbListView, the problem is exactly the same if I use CListView.

Yii 1.1.13
EFancyBox v. 1.6

index.php

$this->widget('bootstrap.widgets.TbListView', array(
	'dataProvider' => $dataProvider,
	'itemView' => '_view',
	'template' => '{summary}{sorter}<div class="clearfix"></div>{pager}<div class="clearfix"></div>{items}{pager}',
));


_view.php
$this->widget('application.extensions.fancybox.EFancyBox', array(
	'target' => 'a[rel=gallery' . $data->id . ']',
	'config' => array(),
		)
);
foreach ( $data->media as $m ) {
	echo CHtml::link(
		CHtml::image(
			$m->getFileByName('thumbnail')->url,
			$m->getFileByName('thumbnail')->filename,
			array('style' => 'height:' . Media::SIZE_MICROTHUMB_HEIGHT . 'px; margin:2px;')
		),
		$m->getFileByName('highRes')->url,
		array(
			'rel' => 'gallery' . $data->id,
			'title' => $m->getFileByName('highRes')->filename,
		)
	);
}
unset($m);


PortfolioController.php
public function actionIndex() {
	$dataProvider = new CActiveDataProvider('Portfolio');
	if (!isset($_GET['ajax'])) {
		$this->render('index', array(
			'dataProvider' => $dataProvider,
		));			
	} else {
		echo 'index',
		$this->renderPartial(
			'index', 
			array(
				'dataProvider' => $dataProvider,
			),
			false,
			true
		);	
	}
}


I believe this is part of a large problem, in which scripts simply aren't updated even though renderPartial() appears to be applied properly. Can anyone help? Thanks in advance!
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