Google Maps Jquery

  • 1
  • Question
  • Updated 2 years ago
I am trying to make this work:
http://help.skuid.com/m/supercharge-your-ui/l/601103-using-the-custom-component-for-custom-page-beha...

Here is what I think it should look like:

skuid.componentType.register('mapAddress',function(element){    
var btn = jQuery('<button>Map Address</button>').button()
        
.on('click',function(){
            
// instantiate a model using the model named "Contacts" 
            
var m = skuid.model.getModel('View_Location');
            
// get the first row (or record) from our model
            
var row = m.getFirstRow();
            
// assemble the mailing address fields
            
var street = m.getFieldValue(row,'{{$Model.View_Location.data.0.Street_Address__c}}');
            
var city = m.getFieldValue(row,'{{$Model.View_Location.data.0.Zip_Postal__r.City__r.City__c}}');
            
var state = m.getFieldValue(row,'{{$Model.View_Location.data.0.Zip_Postal__rState__r.State_Name__c}}');
            
var zip = m.getFieldValue(row,'{{$Model.View_Location.data.0.Zip_Postal__r.Zip_Codes__c}}');
            
var address = street + ' ' + city + ', ' + state + ' ' + zip; 
            
window.open('http://maps.google.com/?q=' + address,'_blank','height=750,width=1100,status=0,menubar=0');
        
});
    
element.append(btn);
});
Photo of Bill Fox

Bill Fox

  • 7,904 Points 5k badge 2x thumb

Posted 2 years ago

  • 1
Photo of Stephen Sells

Stephen Sells, Official Rep

  • 16,856 Points 10k badge 2x thumb
Are you attempting to make it into a custom component or are you wanting to make it the Javascript on each page?

Is it not working for you?
(Edited)