No announcement yet.

Custom listview : link to external content.

  • Filter
  • Time
  • Show
Clear All
new posts

  • Custom listview : link to external content.

    I use Geonames as a way to link multiple locations to an account.

    For this I use an INT field that holds the Geoname ID.

    When in list mode I want to be able to link the ID it to the geonames website :

    So I added a custom view to the /Custom/Resources/layouts/myentity/list.json :

            "view": "views/fields/geoname"
    and created a view based on URL fieldtype: client/src/views/fields/geoname.js

    Espo.define('Views.Fields.Geoname', 'Views.Fields.Base', function (Dep) {
        return Dep.extend({
            type: 'url',
            listTemplate: 'fields.url.list',
            detailTemplate: 'fields.url.detail',
            setup: function () {
                this.params.trim = false;
            data: function () {
                return _.extend({
                    url: this.getUrl()
            getUrl: function () {
                var url = this.model.get(;
                url= ""+url;
                return url;
    Two questions :
    • I would rather move this to a custom area, and not put that directly in /client/. What is the preferred file location for custom views to stay upgrade safe?
    • suggestion : a general wrapper would be better , eg a field type "customlink" with an option to provide a minitemplate in the fielddefinition : for example,if you have an product ID from a third party and want to have direct access, you could provide this minitemplate
      <a href="http://myproductprovidersite/itemdescription/nr/{{field}}"> {{field}} </a>

  • #2
    Create a folder called custom in client directory. Then in the json file, change view to, "Custom:Fields.GeoName". Then in js file, Espo.define("Custom:Views.Fields.GeoName", dependency file,function(Dep). If you don't want to put in the client directory, then you have further investigate how to point view to correct directory.


    • #3
      Thank you, ill try that