clientNavbar extra item

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Kharg
    Senior Member
    • Jun 2021
    • 431

    clientNavbar extra item

    Following https://docs.espocrm.com/development...client-navbar/ I am trying to add a extra navbar item but my icon always end up on the left side of the search bar instead of being with all the other icons on the right side.

    I'd like to understand what I am doing wrong.

    Is the icon supposed to be on the left of the search bar?

    Click image for larger version

Name:	image.png
Views:	7
Size:	7.3 KB
ID:	114041

    Sample code:

    clientNavbar.json

    PHP Code:
    {
        "items": {
            "custom": {
                "view": "custom-nav:views/site/navbar/custom-panel",
                "class": "dropdown hidden-xs custom-container",
                "order": 2
            }
        }
    }
    custom-panel.js
    PHP Code:
    define('custom-nav:views/site/navbar/custom-panel', ['view'], (Dep) => {
        return class extends Dep {
            templateContent = `
            <a
                id="custom-dropdown"
                class="dropdown-toggle"
                data-toggle="dropdown"
                role="button"
                tabindex="0"
                title="{{translate 'Custom' category="scopeNamesPlural"}}"
            ><i class="fas fa-history icon"></i></a>
            <ul class="dropdown-menu" role="menu" aria-labelledby="custom-dropdown">
                <li class="dropdown-header">{{translate 'Custom' category="scopeNamesPlural"}}
                </li>
                {{#each customList}}
                    <li>
                        <a href="#{{./targetType}}/view/{{./targetId}}">
                            <span class="icon-container">{{{./icon}}}</span>
                            {{./targetName}}
                        </a>
                    </li>
                {{/each}}
            </ul>
        `
            data() {
                return {
                    customList: this.customList.map(item => {
                        return {
                            ...item,
                            icon: this.getHelper().getScopeColorIconHtml(item.targetType)
                        };
                    }),
                };
            }
            setup() {
                this.customList= [];
                Espo.Ajax.getRequest('Custom', {maxSize: 10})
                    .then(response => {
                        this.customList= response.list || [];
                        this.reRender();
                    });
            }
            isAvailable() {
                return true;
            }
        };
    });
  • Kharg
    Senior Member
    • Jun 2021
    • 431

    #2
    Fixed, the issue was the order in clientNavbar.json

    An order of 20 is working fine.

    Comment

    Working...