EGMaps不会在renderPartial上加载

时间:2012-01-10 13:34:34

标签: ajax yii renderpartial

我正在试图在局部视图上加载EGMap。这是我的代码:

这是调用动作loadmap的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但不加载地图。任何建议???

萤火虫说:谷歌没有定义

非常感谢!!!

1 个答案:

答案 0 :(得分:1)

我发现它在renderPartial中无法使用Iframe并且您可以更新其src事件。这对我有用了