【发布时间】:2012-01-10 13:34:33
【问题描述】:
我正在尝试在局部视图上加载 EGMap。这是我的代码:
这是调用动作加载图的ajax按钮:
echo CHtml::ajaxsubmitButton ("Press for geolocation",
CController::createUrl('organization/loadmap'),
array('update' => '#formMap'));
动作加载图:
$this->renderPartial('_loadMap',array('model'=>$model),false,true);
最后是局部视图:
$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 但不加载地图。有什么建议???
萤火虫说:谷歌没有定义
非常感谢!!!
【问题讨论】:
-
它有用吗?我现在有这个问题
标签: ajax yii renderpartial