Quantcast
Channel: Yii Framework Forum
Viewing all articles
Browse latest Browse all 18717

Ctabview And Jquery-Gmap Problem

$
0
0
Hello everyone!

I'm using CTabView for my view and to display google map I'm using jquery-gmap extension that can be found from here. The map is inside one of my tab. I don't know why the map doesn't display properly when it's using together with CTabView. I've searched around and found this. My view is like this:

<?php
Yii::import('ext.jquery-gmap.jquery-gmap.*');
$gmap = new EGmap3Widget();
$gmap->setSize(800, 600);
// base options
$options = array(
	'scaleControl' => true,
	'streetViewControl' => false,
	'zoom' => 1,
	'center' => array(0, 0),
	'mapTypeId' => EGmap3MApTypeId::ROADMAP,
	'mapTypeControlOptions' => array(
		'style' => EGmap3MapTypeControlStyle::DROPDOWN_MENU,
		'position' => EGmap3ControlPosition::TOP_CENTER,
	),
	'zoomControlOptions' => array(
		'style' => EGmap3ZoomControlStyle::SMALL,
		'position' => EGmap3ControlPosition::BOTTOM_CENTER
	),
);
$gmap->setOptions($options);
$marker = new EGmap3Marker(array('title' => CHtml::encode(Hotel::model()->findByPk($model->hotel_id)->hotel_name)));
$marker->latLng = array($model->hotel_lat, $model->hotel_lng);
$marker->centerOnMap();
$marker->setMapZoom(10);
$gmap->add($marker);
$gmap->renderMap();

$click_script = <<<script
    $('#tab5').click(function(){
        google.maps.event.trigger(gmap, "resize");
    }) 
SCRIPT;
Yii::app()->getClientScript()->registerScript("resizemap_js", $click_script, CClientScript::POS_END);
?>

But the map looks still incorrectly.
: Capture.PNG
What should I do to run out of this problem?

Any help would be appreciated!

Viewing all articles
Browse latest Browse all 18717

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>