Thanks for your reply but I think in iframe, google is preventing the loading of the map. and using the resize method and delay, still not working. This is the code the dialog trigger
I would loved to volunteer but im not expert in php
I attached the class I created and include this function in EGMap.php
public function addAutocomplete($inputId = null)
{
Yii::app()->getClientScript()->registerScriptFile('http://maps.googleapis.com/maps/api/js?sensor=false&libraries=places');
if ($inputId === null)
$autocomplete = new EGMapAutocomplete();
else
$autocomplete = new EGMapAutocomplete($inputId);
$this->resources->add('autocompletes', new CTypedList('EGMapAutocomplete'));
$this->resources->itemAt('autocompletes')->add($autocomplete);
}
and this code to activate the autocomplete
$gMap->addAutocomplete();
but the thing is the jscode inside the class is not generating. For sure Im missing something here ehehe so you may wanna look if you have time thanks
It doesn’t write cuz it is not registered… Seems an interesting addition, will look onto the best way to add it to the library. Thanks.
PS: The google maps api is already registered, what we need to add is the ‘libraries=places’ parameter to the insertion, thus, the use of EGMapAutocomplete class maybe not a right way to do it. Will keep you updated.
public function getAutocompleteJs()
{
$return = '';
if (null !== $this->resources->itemAt('autocomplete'))
{
foreach ($this->resources->itemAt('autocomplete') as $autocomplete)
{
$return .= $autocomplete->toJs($this->getJsName());
$return .= "\n ";
}
}
return $return;
}
and this line
$init_events[] = $this->getAutocompleteJs();
in
public function registerMapScript
the jscode of Autocomplete now displays but it says google.maps.places is undefined. is this because you say that its not registered? in the reference of google you only need this
If you look at the registerMapScript function you will realize that the API script is registered without the ‘libraries’ param (line 488-494 of EGmap.php), add this to $params variable.
$params .= '&libraries=places';
Should work.
Nevertheless, I realized that places could be a great addition to EGMap and autocomplete is just a small thing onto the places functionality. I remember adding it long time a go but I got ‘trap’ by current projects. I will add it as soon as I have time
there is a little issue … since I rendered it through dialog… I see the “Enter a location” which is generated by the autocomplete api but the dropdown autocomplete is not showing… maybe it’s the same with my previous issue with the map displaying broken on the dialog but already fixed with setTimeOut() and resize, is it the div/css of the dropdown?
I read again the thread and it seems that they’re adding multiple cluster on the js itself and not on the extension that you made. In your extension, adding clusterer is possible but you can only add one right?
Is there a way to add multiple clusterer in your extension?
I am just starting to learn this extension which is really nice by the way and I am trying to go through all of the examples that are listed but I am running into a problem with the advanced example that Johnatan has posted. I keep getting an error that says $items is undefined. Does anyone know where this is supposed to be declared or what is is supposed to reference?
Also, I know he mentions that $map is model of a database table used to save coordinates but can anyone tell me or show me what exactly this model and database table contain? Thanks