Bruce Stuart
Posts: 0
Joined: Fri Oct 24, 2014 4:42 am

Build map , call service to update data , return - map is 'lost'....

i've been working for over 8 hours on this problem and time to call in the experts.

In my app, on a UI where I have a map, and I am dropping markers based on user input, the app:

  1. Creates a map and drops markers based on data in a db (works great)

  2. Prompts the user if s.he would like to add new markers, if so - gathers input, drops a new marker, and updates the DB for the new marker. I use a rest service to udpate the DB.

  3. After calling the rest-service - exactly between the Javascript I run before the service executes mappings and updates the DB - and running the success event on the way back - my 'map' loses it's mind (the center moves to somewhere out in the Indian ocean (not desired lol) - and turns black (since there is no data for zoom 17 where it(the map) lands).....i've tried dealing with the after effects and just resetting the map center - still no luck.

    if I take out the call to the data service - life is good and the map stays fine. I'm gathering data in a popup - writing the marker on the map, and then calling the rest service to update the data.

    It appears that the framework has code in the event to update the DB that tries to show-hide my controls.... from the interpreted code in my debugger I see:

    Apperyio.CurrentScreen = 'page_holedetail';
    _.chain(Apperyio.mappings).filter(function(m) {
    return m.homeScreen === Apperyio.CurrentScreen;
    }).each(Apperyio.UIHandler.hideTemplateComponents);

    Is this or some other event causing my ill-desired behavior? if so - how do I work around it? I've tried changing the timing of this event , waiting till my popup closes and writing the data - the result is the same - calling a rest service to udpate data when my map is showing - causes this 'blackout' effect.

    Best,

    Bruce

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Build map , call service to update data , return - map is 'lost'....

Hello!

Instead success try using complete event. Please post screenshots of service mapping you use. Map shouldn't move for no reason...

Bruce Stuart
Posts: 0
Joined: Fri Oct 24, 2014 4:42 am

Build map , call service to update data , return - map is 'lost'....

Maryna,

Thanks for the quick reply.

Here's a few more details. I gather information in a popup window that is 'on-top' of the map, when the user clicks 'drop marker' (essentially the 'OK' button on the popup) --- I kick off the events to drop the marker on the page.

Without the call to my rest service - the popup closes, the pin-marker (that has amination turned on ) - drops gracefully from the top of the map - onto the desired place on the map.

When the rest - service is invoked - from the button click - that's where the fallout occurs. I've put debugging code in the rest-service to see where the map loses it's mind - and it's between the before mapping - and the return in the success .

The mapping is very simple and has little logic. here is the code from the Javascript before launching the map (includes my feeble attempt at saving the center ) :

(of note - since the event to write data to the db has no impact on the map - ui - there is no mapping in the success event - see attached)....

Javascript in the before updating event:
Image

The Mapping used to update the data:
Image

The Script in each one of the items with the 'blue' JS indicator - in order:

Image

Image

Image

Image

Bruce Stuart
Posts: 0
Joined: Fri Oct 24, 2014 4:42 am

Build map , call service to update data , return - map is 'lost'....

continued...

Image

mapping on success (no mapping since the success does not impact the UI)
Image

javascript in the complete event:

Image

and code that kicks all this off (from the OK button on my popup):

// call the services to update the records...
if ( localStorage.getItem('bdoupdate') ) {

Code: Select all

 var sselected = Appery('select_markertype').val(); 
 if ( sselected === "T" || sselected === "G" ){ 

service_updateholedata.execute();
}
else {
service_writenewholerecord.execute();
}
}

// editorially - both events (the updateholdate and the writenewholerecord both cause the map disfunction - and contain different mappings and different JS code...
but both are very simple update methods....

Bruce Stuart
Posts: 0
Joined: Fri Oct 24, 2014 4:42 am

Build map , call service to update data , return - map is 'lost'....

Has anyone had a chance to look at this issue?

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

Build map , call service to update data , return - map is 'lost'....

Hello Bruce,

Sorry for delay, we are working on it and will get back to you with the update.

Bruce Stuart
Posts: 0
Joined: Fri Oct 24, 2014 4:42 am

Build map , call service to update data , return - map is 'lost'....

Evgene ,

Thanks so much... Let me know if you need any other code snippets or any help reproducing the problem..thanks again... Bruce

Alena Prykhodko
Posts: 0
Joined: Tue Apr 09, 2013 7:36 am

Build map , call service to update data , return - map is 'lost'....

You may have problems because service and javascript work with map at the same time. Try to create sequence instead of parallel execution.

Bruce Stuart
Posts: 0
Joined: Fri Oct 24, 2014 4:42 am

Build map , call service to update data , return - map is 'lost'....

Alena,

thanks for the reply. I'm not sure I understand what you are asking me to do, and what the benefit is.

You're saying I should 'wait' for execution of one to complete (say the map update) and then execute the database update? Make them serial instead of parallel ?

I'll do that now assuming that's what you are asking for - and post results within the next hour.

Thanks....

Bruce

Return to “Issues”