custom views detail document

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • item
    Active Community Member
    • Mar 2017
    • 1476

    custom views detail document

    Dear,
    I have a custom views details for document entity. I have too two Document folder.
    I have custom button, for each type of document. I push button (right) with
    this.menu.buttons.push({

    1) I click document .. and I see 2 document folder
    2) I click one document folder and see list view of document
    3) when I click one document, I see detail view of document
    But I don't see my button, I must "refresh" the page in navigator to view the button.

    I have try the other way.., I push all button.. and then in
    afterRender: function () {
    I hide the button..
    And same behaviour.. I must "refresh" the page in navigator to hide the button.

    Is there a function I can call ? and not manually refresh the page in navigator ?

    Regards
    If you could give the project a star on GitHub. EspoCrm believe our work truly deserves more recognition. Thanks.​
  • tanya
    Senior Member
    • Jun 2014
    • 4308

    #2
    Hi,
    you must refresh the page once after the modification or each time?

    Comment

    • eymen-elkum
      Active Community Member
      • Nov 2014
      • 472

      #3
      view.rerender() may helps sometimes
      CEO of Eblasoft
      EspoCRM Expert since 2014
      Full Stack Web Developer since 2008
      Creator of Numerous Successful Extensions & Projects​

      Comment

      • item
        Active Community Member
        • Mar 2017
        • 1476

        #4
        Hi,
        thanks for the reply,
        I must refresh the page on navigator for see my button. All time.. when I change "folder document".
        When we change document folder and then click on a document, we need to refesh page for see the button.
        Is like, the header where button are not "refresh" ..

        I have try view.rerender() or this.view.rerender(). ... but not available.
        In attachment, you can see ... first time no button, refresh on navigator and the button appears.

        HTML Code:
            setup: function () {
                Dep.prototype.setup.call(this);
                    if (this.model.get('type') == 'SepaXml' ){
                        this.addMenuItem('buttons', {
                            name: 'getSepaXml',
                            label: 'getSepaXml',
                            style: 'default',
                            action: 'getSepaXml'
                        }, true); 
                    }
                    if (this.model.get('type') == 'ContactOffice' ){
                        this.addMenuItem('buttons', {
                            name: 'getContactOfficePushResult',
                            label: 'getContactOfficePushResult',
                            style: 'default',
                            action: 'getContactOfficePushResult'
                        }, true);  
                    }
                },
            afterRender: function () {
              Dep.prototype.afterRender.call(this);
        
                    if (this.model.get('type') == 'SepaXml' ){
                        Espo.Ui.notify("SepaXml", 'info', 2000); 
                        this.$el.find('a[data-name="getContactOfficePushResult"]').addClass('disabled');
                    }
                    if (this.model.get('type') == 'ContactOffice' ){
                        Espo.Ui.notify("Contact Office", 'info', 2000); 
                        this.$el.find('a[data-name="getSepaXml"]').addClass('disabled');
                    }
                    // this.getView('header');
                    //console.log(this.getView('header').getItems());
                    //console.log(this);
                   // this.view.rerender();
            },

        Regards
        Last edited by item; 01-04-2019, 10:08 PM.
        If you could give the project a star on GitHub. EspoCrm believe our work truly deserves more recognition. Thanks.​

        Comment

        • telecastg
          Active Community Member
          • Jun 2018
          • 907

          #5
          This is an old posting but the reason why the method "reRender" was not functioning in this case is two fold:

          1) Spelling: the correct name is reRendering() not rerendering()
          2) Scope: if you are already working in a view the correct reference is this.reRender() because "this" refers to the current view script

          Hope this helps someone else having the same issue
          Last edited by telecastg; 07-13-2020, 07:08 AM.

          Comment

          Working...