Hello!
I'm triying to load an EGMap on a partial view. This is my code:
This is the ajax button which calls the action loadmap:
The action loadmap:
And finally the partial view:
The website loads the div but not the map. Any suggestion???
Thank you so much!!!
I'm triying to load an EGMap on a partial view. This is my code:
This is the ajax button which calls the action loadmap:
<?php echo CHtml::ajaxsubmitButton ("Press for geolocation", CController::createUrl('organization/loadmap'), array('update' => '#formMap')); ?>
The action loadmap:
$this->renderPartial('_loadMap',array('model'=>$model),false,true);
And finally the partial view:
<div id="formMap"> <?php $address = $model->address . ", " . City::model()->giveLocation($model->cityID); echo $address; Yii::import('ext.EGMap.*'); $gMap = new EGMap(); $gMap->zoom = 5; $gMap->width = '100%'; $gMap->height = 200; $mapTypeControlOptions = array( 'position'=> EGMapControlPosition::RIGHT_TOP, 'style'=>EGMap::MAPTYPECONTROL_STYLE_DEFAULT, ); $gMap->mapTypeId = EGMap::TYPE_HYBRID; $gMap->mapTypeControlOptions= $mapTypeControlOptions; // Create geocoded address $geocoded_address = new EGMapGeocodedAddress($address); $geocoded_address->geocode($gMap->getGMapClient()); // Center the map on geocoded address $gMap->setCenter($geocoded_address->getLat(), $geocoded_address->getLng()); // Add marker on geocoded address $gMap->addMarker( new EGMapMarker($geocoded_address->getLat(), $geocoded_address->getLng()) ); $gMap->renderMap(); ?> </div>
The website loads the div but not the map. Any suggestion???
Thank you so much!!!