Found this issue with both 1.0.16 and 1.0.18 when using a Google v3 map in Terratype when the datatype is a property on a Grid (via LeBlender).
No matter what the value is set to by the content editor for the instance of the Grid , Terratype serves the default values set at the datatype level. The following is in my Grid's view file:
@inherits UmbracoViewPage<Lecoati.LeBlender.Extension.Models.LeBlenderModel>
var item = Model.Items.ElementAt(0);
var map = item.GetValue<Terratype.Models.Model>("map");
@Html.Terratype(map)
When inspecting the values of map.Position and map.Zoom, the datatype defaults are returned.
However, if I make a second variable to the raw value like so:
var mapJson = System.Web.Helpers.Json.Decode(item.GetRawValue("map"));
@Html.Terratype(new Options { Position = new Terratype.CoordinateSystems.Wgs84(mapJson.position.datum), Zoom = mapJson.zoom }, map)
By manually passing the dynamic Json from the raw property value to the Options override, I get the correct map.
I'm not someone who uses or understands the Grid, so sorry for my ignorance.
For my Terratype tests, I use
@CurrentPage.GetGridHtml("grid")
To render a grid, and let whatever or however the grid does it stuff to pop out a rendered Terratype map if its present within the Grid's content.
My quick tests on 1.0.18, suggest this is still functioning.
I wanted to try and replicate what you are doing, so can you tell me how you are calling your 'Grid View file' and where is it located. The one with the following contents:-
@inherits UmbracoViewPage<Lecoati.LeBlender.Extension.Models.LeBlenderModel>
var item = Model.Items.ElementAt(0);
var map = item.GetValue<Terratype.Models.Model>("map");
@Html.Terratype(map)
oh, and describe this using steps to someone who doesn't understand the Grid.
When I use the automatically generated "Map" grid editor (presumably this was made by Terratype when I installed it) it renders the correct position and zoom on the website as overridden by the content editor:
Here is my custom "Location" grid setup via LeBlender. The "Map (Australia)" datatype is an instance of Terratype with the v3 Google Maps engine. The default position is set in the datatype to central Sydney. The issue is, when rendering the Terratype HTML helper in the Location.cshtml grid view, no matter what the content editor overrides as the map position and zoom for "Location" it will always show the default Sydney position. That is, until I found my workaround as described in the first post.
Terratype serving incorrect position and zoom when used in Grid Editor
Hi all,
Found this issue with both 1.0.16 and 1.0.18 when using a Google v3 map in Terratype when the datatype is a property on a Grid (via LeBlender).
No matter what the value is set to by the content editor for the instance of the Grid , Terratype serves the default values set at the datatype level. The following is in my Grid's view file:
When inspecting the values of map.Position and map.Zoom, the datatype defaults are returned.
However, if I make a second variable to the raw value like so:
By manually passing the dynamic Json from the raw property value to the Options override, I get the correct map.
Cheers,
Simon
Hi Simon,
I'm not someone who uses or understands the Grid, so sorry for my ignorance.
For my Terratype tests, I use
To render a grid, and let whatever or however the grid does it stuff to pop out a rendered Terratype map if its present within the Grid's content.
My quick tests on 1.0.18, suggest this is still functioning.
I wanted to try and replicate what you are doing, so can you tell me how you are calling your 'Grid View file' and where is it located. The one with the following contents:-
oh, and describe this using steps to someone who doesn't understand the Grid.
Cheers
Jonathan
Hi Jonathan,
The views used by the grid editor are in ~\Views\Partials\Grid\Editors.
Editors are loaded on a main view like so (where contentBlocks is the doctype property containing the grid editors datatype):
This Umbraco article is the best place to learn up on Grids:
https://our.umbraco.org/documentation/getting-started/backoffice/property-editors/built-in-property-editors/Grid-Layout
When I use the automatically generated "Map" grid editor (presumably this was made by Terratype when I installed it) it renders the correct position and zoom on the website as overridden by the content editor:
Here is my custom "Location" grid setup via LeBlender. The "Map (Australia)" datatype is an instance of Terratype with the v3 Google Maps engine. The default position is set in the datatype to central Sydney. The issue is, when rendering the Terratype HTML helper in the Location.cshtml grid view, no matter what the content editor overrides as the map position and zoom for "Location" it will always show the default Sydney position. That is, until I found my workaround as described in the first post.
is working on a reply...