Hello. I’ve got a question. I try to update content of my div (this is egmap div: #EGMapContainer1) using CGridView and it’s ajaxUpdate property. When I try to navigate between records (for example using pagination), content of my div becomes empty (blank). At which point I’m doing wrong? Firebug does not reports ane errors.
This is my code. Thanks
<?php $this->widget('zii.widgets.grid.CGridView', array(
'id'=>'maps-grid',
'dataProvider'=>$model->search(),
'filter'=>$model,
'ajaxUpdate'=>'EGMapContainer1',
'columns'=>array(
'id',
'idgatunku',
'lat',
'lng',
'name',
array(
'class'=>'CButtonColumn',
),
),
)); ?>
<?php
/* @var $this MapaController */
/* @var $model Mapa */
$map = Maps::model();
$lat = $model->lat;
$lng = $model->lng;
Yii::import('ext.gmap.*');
$gMap = new EGMap();
$gMap->zoom = 2;
$mapTypeControlOptions = array(
'position'=> EGMapControlPosition::LEFT_BOTTOM,
'style'=>EGMap::MAPTYPECONTROL_STYLE_DROPDOWN_MENU
);
$gMap->mapTypeControlOptions= $mapTypeControlOptions;
$gMap->setCenter(39.721089311812094, 2.91165944519042);
$dataProvider=$model->search();
$i = 0;
if ( $dataProvider->getData() ) {
foreach ($dataProvider->getData() as $row) {
$i++;
// Create marker
$marker = new EGMapMarker($row['lat'], $row['lng']);
$gMap->addMarker($marker);
}
}
$gMap->enableMarkerClusterer(new EGMapMarkerClusterer());
$gMap->renderMap();
?>