Coder Social home page Coder Social logo

Comments (7)

valentasm1 avatar valentasm1 commented on August 12, 2024

First of all you should use map event to find when map is loaded. Check example in readme(front page)

OnAfterInit="@(async () => await OnAfterInitAsync())"

Second this is very bad. Component is redrawn each time any value changes and it will be trigered each time.

if (!firstRender)

Also you should try debug with edge application and see if any markers is added to markers.
In my opinion you should change and OnAfterInit event and it should work

from blazorgooglemaps.

Essum13 avatar Essum13 commented on August 12, 2024

@valentasm1 m1, thank you for the fast response. I implemented your suggestions but i still got the same problem.

Since i have the markers written out on the map, shouldnt they exist?
I did a Console.WriteLine(map) in the OnAfterInitAsync() method and in the method onFilterSelected. In the OnAfterInitAsync() method i find the object and get "GoogleMapsComponents.GoogleMap" written out and in the onFilterSelected method it writes out nothing.

It seems like i still have the same problem accessing the map object..

from blazorgooglemaps.

valentasm1 avatar valentasm1 commented on August 12, 2024

If i understand correctly it is not issue with accessing map. There is issue with Stack markers .
I think you should create github or zip solution that i could reproduce issue. You could make just part of not working. No need all solution.
Again i think this is not map issue, but something with lifecycle or business logic. Of course i could be wrong.

from blazorgooglemaps.

Essum13 avatar Essum13 commented on August 12, 2024

@valentasm1, I created a repo with the same problem: https://github.com/Essum13/GoogleMapsBlazorIssues.git
Wrote some comments inside the BaseClass.

(I removed valid google maps api key).

from blazorgooglemaps.

valentasm1 avatar valentasm1 commented on August 12, 2024

Thank you for you time preparing github. Now i get it.
Dont take anything personally. You inheritance is strange. I think i mixed up functionality. If two components inherit same base it doesnt mean they share same instance.
SearchComponent < MapBase
AND
Map < MapBase

You see. If you draw smth on map.razor then SearchComponent.razor < Map base doesnt know anything about it.
My suggestion is to create MyMapComponent where you bind Locations via [Parameter] property from parent component. Parent component have all info about locations and it changes then child will update automatically. Then on parent if you change Select control, then you already know info about locations.

My suggestion read this documentations. Especial part about child components which is relavant to you. It a bit hard to grasp so probably you will need to read several times and compare with other recourses.
https://docs.microsoft.com/en-us/aspnet/core/blazor/components/?view=aspnetcore-3.1

from blazorgooglemaps.

valentasm1 avatar valentasm1 commented on August 12, 2024

Closing

from blazorgooglemaps.

Essum13 avatar Essum13 commented on August 12, 2024

@valentasm1, ahhh that makes sense haha! Thank you for your time! I will solve my problem now.

from blazorgooglemaps.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.