Iam a yii newbie (started a week ago) and i want to use the yii Bootstrap Thumbnail grid in order to display some countries images, and then i want to drill in each country and display the cities, etc, without reloading the entire screen, just the right side.
Code for the create view
echo $this->renderPartial('_form', $this);
Between other things this view below is used to display the images. It has two divs. One for picking the images that relates to the countries/cities, the other displays the choice that the user made in terms of city by clicking in a button that is supposed to be near the picture, but only when the user drills into the cities.
1st doubt -> should i be rendering partials? I only want to refresh the right side of the screen, the one that has the images. Take into account that iam rendering one partial in the previous code, and other below. Is that even possible?
$this->renderPartial('_formCountry', $this);
This view is responsible for loading the widget
$dataProvider = new CActiveDataProvider('Country');
$this->widget('bootstrap.widgets.TbThumbnails', array(
'id' => 'countryThumbId',
'dataProvider' => $dataProvider,
'template' => "{items}\n{pager}",
'itemView' => '_countryThumb',
));
The view below fills it with images of the countries, and sends the id of Country via post.
2nd doubt -> How can i drill down clicking the image, instead of having a button to do that???
echo $this->createUrl('city/view', array('id' => $data['id']));
$this->widget('bootstrap.widgets.TbButton', array(
'label' => 'cidades',
'buttonType' => 'ajaxButton',
'type' => 'primary', // null, 'primary', 'info', 'success', 'warning', 'danger' or 'inverse'
'size' => 'mini', // null, 'large', 'small' or 'mini'
'url' => Yii::app()->createUrl("tripDetail/showCities"),
'ajaxOptions' =>
array('data' =>
array(
'id' => $data['id'],
),
'type' => 'POST',
)
)
);
This action is fired upon button click and gets a new dataProvider based on the country the user picked
3rd doubt -> how many renderPartials can be nested????
public function actionShowCities()
{
$cityId = $_POST['id'];
$dataProvider = $this->getCities($cityId);
$this->renderPartial('_formCity', array('dProvider'=>$dataProvider));
}
*The action above fires up this view _formCity which in turn calls _cityThumb*
$this->widget('bootstrap.widgets.TbThumbnails', array(
'id' => 'countryThumbId',
'dataProvider' => $dProvider,
'template' => "{items}\n{pager}",
'itemView' => '_cityThumb',
));
*_cityThumb*
4th doubt -> The cities were the only screen that was rendered, when i clicked the button to show me the cities, nothing happened, why????
echo $this->createUrl('place/view', array('id' => $data['id']));
Sorry for the long post and so many doubts, but its my first time with a php framework....and yii is not that easy, at least at first. :-[