Announcement

Collapse
No announcement yet.

Google Map integration

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Google Map integration

    Hello,

    I'm trying to make a new entity with latitude and longitude fields. I couldn't know where to start to add a map to the edit view and bind its markers lat and lng to the fields in the entity (pure js).

    any help?

  • #2
    Hi

    I need to create a new field view. There are a lot of examples in the EspoCRM. Specify view class in entityDefs.

    Comment


    • #3
      ok it felt as if i kinda started getting it, you mean like

      "views":{
      "detail":"Crm:Meeting.Detail"
      },
      "recordViews":{

      until i couldn't understand how to create my own, am i missing the docs (i couldn't find any)?

      Comment


      • #4
        so the question becomes, how can i create a new field type?
        Last edited by JacerOmri; 05-08-2015, 05:49 PM.

        Comment


        • #5
          application/Espo/Modules/Crm/Resources/metadata/entityDefs/Case.json

          There is "view": "Crm:Case.Fields.Contact"

          If you specify "view": "Custom:Case.Fields.Contact" it will mean clients/custom/res/views/case/fields/contact.js directory

          Comment


          • #6
            Thank you yurikuzn for your help,
            I spent some time reading the source code trying to understand it.
            As far as i went, i think i need a .tpl file to actually show the map (the div#map that will hold the map) and initialize it in the field's javascript code.

            I also noticed that i would use 'jsonObject' as field type and store lat and lng inside it, rather than creating two float fields and changing their value.

            if my guess about the .tpl file is right, can i get any guidance to make it?

            please correct me if i'm wrong, i tried to write down what i could understand, and i would be grateful if you correct me.

            Comment


            • #7
              clients/custom/src/views/contact/fields/map.js
              PHP Code:
              Espo.define('Custom:Views.Contact.Fields.Map''Views.Fields.Base', function (Dep) {

                  return 
              Dep.extend({

                       
              template'custom:contact.fields.map'// means clients/custom/res/templates/contact/map.tpl,


                     
              afterRender: function () {
                           
              // your code
                     
              },
                
                  });
              }) 



              I'd rather use two float fields instead of jsonObject.

              Comment

              Working...
              X