We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 10378
    • 375 Posts
    Hi,

    I have a problem with the rowExpander plugin for MODX Grid:

    If a row is expanded and the grid is refreshed, the expanded row seems to collapse but the [+] sign stays at [-].
    So I tried to collapse all expanded rows before refresh happens.

    This is the part where the rowExpander is defined:

        // A row expander for newsletter grid rows (additional informations)
        this.exp = new Ext.ux.grid.RowExpander({
            tpl: new Ext.Template(nlInfos)
            ,enableCaching: false
        });
    


    Here is the code part where I'm calling the collapseAll method:

        {
                xtype: 'xcheckbox'
                ,id: 'autorefresh'
                ,name: 'autorefresh'
                ,boxLabel: _('goodnews.newsletter_grid_autorefresh')
                ,description: _('goodnews.newsletter_grid_autorefresh_tooltip')
                ,hideLabel: true
                ,ctCls: 'gon-checkbox-toggle'
                ,inputValue: 1
                ,listeners: {
                    'check': function(cbx,checked){
                        this.collapseAll();
                        this.toggleAutoRefresh(cbx,checked);
                    }
                    ,scope:this
                }
            }
    


    The problem is - if I call the collapseAll method I get the following error in console log:

    Uncaught TypeError: this.exp.collapseAll is not a function
        at GoodNews.grid.Newsletters.collapseAll (modx.grid.js:512)
        at GoodNews.grid.Newsletters.check (newsletters.panel.js:270)
        at h.Event.fire (ext-all.js:21)
        at S.fireEvent (ext-all.js:21)
        at S.setValue (ext-all.js:21)
        at S.setValue (utilities.js:509)
        at S.onClick (ext-all.js:21)
        at HTMLInputElement.I (ext-all.js:21)
    



    I had a look at the code in modx.grid.js

        ,collapseAll: function() {
            if (!this.exp) return false;
    
            this.exp.collapseAll(); <--- this line throws an error!
            this.tools['minus'].hide();
            this.tools['plus'].show();
            return true;
        }
    


    Any hint on how to solve this?
    Could this be a bug in MODXExt?

    Thanks,
    Martin
      Freelancer @bitego http://www.bitego.com
      ---
      GoodNews - one of the most advanced and integrated Group Mailer premium add-ons for MODX Revolution!
      More infos here: http://www.bitego.com/extras/goodnews/
    • Indeed. It is a bug. I found out this commit https://github.com/Alroniks/revolution/commit/26583acc454bf85f0f28d53005fa8012984b7a98

      It explains the issue. In removed strings method exists in the news - no.
        Alroniks experts
        MODX Ambassador | MODX Professional

        alroniks.com | [email protected] | +375 33 638 10 92 (Belarus)
        Facebook | Twitter | VK.com
      • I created issue about it on GitHub - https://github.com/modxcms/revolution/issues/13989
          Alroniks experts
          MODX Ambassador | MODX Professional

          alroniks.com | [email protected] | +375 33 638 10 92 (Belarus)
          Facebook | Twitter | VK.com
          • 10378
          • 375 Posts
          Thank you Ivan!

          There is another bug too (which was the initial reason I tried the collapseAll method):

          If a row is expanded and the grid is refreshed, the expanded row seems to collapse but the [+] sign stays at [-].

          Expected behavior:

          The row should stay expanded on grid refresh and the rowExpander content should be refreshed too.

          I also filed an issue at GitHub: https://github.com/modxcms/revolution/issues/13991

            Freelancer @bitego http://www.bitego.com
            ---
            GoodNews - one of the most advanced and integrated Group Mailer premium add-ons for MODX Revolution!
            More infos here: http://www.bitego.com/extras/goodnews/