location option doesn't work in coordinate picker
Closed this issue · 2 comments
I have tried to change the value of location, but it does not give an effect.
Here is my code :
echo $form->field($model, 'kordinat')->widget('\pigolab\locationpicker\CoordinatesPicker' , [ 'key' => 'AIzaSyDXy1YolfbFm2zxuRjqmmhVFSfaQYO00zE' , // require , Put your google map api key 'valueTemplate' => '{latitude},{longitude}' , // Optional , this is default result format 'options' => [ 'style' => 'width: 100%; height: 400px', // map canvas width and height ] , 'enableSearchBox' => true , // Optional , default is true /*'searchBoxOptions' => [ // searchBox html attributes 'style' => 'width: 300px;', // Optional , default width and height defined in css coordinates-picker.css ], 'searchBoxPosition' => new JsExpression('google.maps.ControlPosition.TOP_LEFT'), // optional , default is TOP_LEFT */ 'mapOptions' => [ // google map options // visit https://developers.google.com/maps/documentation/javascript/controls for other options 'mapTypeControl' => false, // Enable Map Type Control 'mapTypeControlOptions' => [ 'style' => new JsExpression('google.maps.MapTypeControlStyle.HORIZONTAL_BAR'), 'position' => new JsExpression('google.maps.ControlPosition.TOP_LEFT'), ], 'streetViewControl' => false, // Enable Street View Control ], 'clientOptions' => [ // jquery-location-picker options 'mapTypeId' => new JsExpression('google.maps.MapTypeId.SATELLITE'), 'location'=>[ 'latitude'=>2.32794242, 'longitude'=>99.08561091, ], 'zoom' => 15, 'radius' => 300, 'addressFormat' => 'street_number', ] ]);
if I check in Ctrl+U, the result still wrong like below :
"location":{"latitude":40.7324319,"longitude":-73.824807777778} <== default value
Is there a way how set the value of location if I need to set this location as default value?
'location'=>[
'latitude'=>2.32794242,
'longitude'=>99.08561091,
],
I will fix this issue , if no value in model.
if you use CoordinatesPicker , you don't need set 'location'=>[ 'latitude'=>2.32794242, 'longitude'=>99.08561091, ] in this widget.
you can set value in your $model
ex: $model->kordinat = "2.32794242,99.08561091";