Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

checkboxgroup/radiogroup issue in MODx.FormPanel #12177

Closed
Jako opened this issue Nov 25, 2014 · 9 comments · Fixed by #16404
Closed

checkboxgroup/radiogroup issue in MODx.FormPanel #12177

Jako opened this issue Nov 25, 2014 · 9 comments · Fixed by #16404
Labels
bug The issue in the code or project, which should be addressed.

Comments

@Jako
Copy link
Collaborator

Jako commented Nov 25, 2014

If a MODx.FormPanel contains a checkboxgroup/radiogroup this panel is not rendered because of nodeToRecurse.items is an array in utilities.js (line 65) for the checkboxgroup/radiogroup item and that has not the method each.

I don't know how to fix that without breaking recursive work of that function.

@argnist
Copy link
Contributor

argnist commented Nov 27, 2014

Any examples?

@Jako
Copy link
Collaborator Author

Jako commented Nov 27, 2014

Do you want to check the issue live in my dev installation? Or should I strip the extjs code down?

Basically it is caused on this MODx.Panel:

ImportIt.panel.ImportExportForm = function (config) {
    config = config || {};
    this.ident = config.ident || 'importit-mecitem' + Ext.id();
    Ext.applyIf(config, {
        id: this.ident,
        items: [{
            xtype: 'modx-tabs',
            deferredRender: false,
            forceLayout: true,
            defaults: {
                layout: 'form',
                autoHeight: true,
                hideMode: 'offsets',
                padding: 15
            },
            items: [{
                xtype: 'modx-formpanel',
                items: [{
                    fieldLabel: _('importit.importform_mode'),
                    xtype: 'radiogroup',
                    items: [{
                        xtype: 'radio',
                        boxLabel: _('importit.importform_mode_append'),
                        name: 'mode',
                        id: 'importit-panel-importform-mode-append',
                        value: 'append',
                        inputValue: 'append',
                        checked: true
                    }, {
                        xtype: 'radio',
                        boxLabel: _('importit.importform_mode_update'),
                        name: 'mode',
                        id: 'importit-panel-importform-mode-update',
                        value: 'update',
                        inputValue: 'update'
                    }, {
                        xtype: 'radio',
                        boxLabel: _('importit.importform_mode_replace'),
                        name: 'mode',
                        id: 'importit-panel-importform-mode-replace',
                        value: 'replace',
                        inputValue: 'replace'
                    }]
                }]
            }]
        }]
    });
    ImportIt.panel.ImportExportForm.superclass.constructor.call(this, config);
};
Ext.extend(ImportIt.panel.ImportExportForm, MODx.Panel);
Ext.reg('importit-panel-importexportform', ImportIt.panel.ImportExportForm);

If the xtype: 'radiogroup', is removed, the Panel is rendered.

Otherwise there is a Uncaught TypeError: undefined is not a function in utilities.js:65

@argnist
Copy link
Contributor

argnist commented Nov 27, 2014

Here that's ok: https://github.com/modxcms/revolution/blob/master/manager/assets/modext/widgets/security/modx.panel.user.js#L492

Try to extend panel from MODx.FormPanel instead of MODx.Panel as other core panels do. See file I mentioned. It has tabs and radiogroups as you need.

@Jako
Copy link
Collaborator Author

Jako commented Nov 27, 2014

Extend from MODx.FormPanel makes no difference (same error occurs).

For some reason on this panel the items of xtype 'radiogroup' is an array of objects instead of an Ext.util.MixedCollection containing 'items' that is an array of objects.

@argnist
Copy link
Contributor

argnist commented Nov 27, 2014

Have you removed xtype: 'modx-formpanel' after extending? Try to rewrite modx.panel.user with your fields.

@Jako
Copy link
Collaborator Author

Jako commented Nov 27, 2014

I have removed that.

To reproduce what is going wrong you could use the following stripped code in a CMP:

ImportIt = function (config, getStore) {
    config = config || {};
    Ext.applyIf(config, {});
    ImportIt.superclass.constructor.call(this, config);
    return this;
};
Ext.extend(ImportIt, Ext.Component, {
    page: {}, window: {}, grid: {}, tree: {}, panel: {}, combo: {}, config: {}, util: {}
});
Ext.reg('importit', ImportIt);
ImportIt = new ImportIt();

Ext.onReady(function () {
    MODx.load({xtype: 'importit-page-import'});
});

ImportIt.page.Import = function (config) {
    config = config || {};
    Ext.applyIf(config, {
        formpanel: 'importit-panel-import',
        components: [{
            xtype: 'importit-panel-import'
        }]
    });
    ImportIt.page.Import.superclass.constructor.call(this, config);
};
Ext.extend(ImportIt.page.Import, MODx.Component);
Ext.reg('importit-page-import', ImportIt.page.Import);

ImportIt.panel.Import = function (config) {
    config = config || {};
    Ext.applyIf(config, {
        items: [{
            fieldLabel: 'Import Mode',
            xtype: 'radiogroup',
            items: [{
                xtype: 'radio',
                boxLabel: 'Append',
                name: 'mode',
                id: 'importit-panel-importform-mode-append',
                value: 'append',
                inputValue: 'append',
                checked: true
            }, {
                xtype: 'radio',
                boxLabel: 'Update',
                name: 'mode',
                id: 'importit-panel-importform-mode-update',
                value: 'update',
                inputValue: 'update'
            }, {
                xtype: 'radio',
                boxLabel: 'Replace',
                name: 'mode',
                id: 'importit-panel-importform-mode-replace',
                value: 'replace',
                inputValue: 'replace'
            }]
        }]
    });
    ImportIt.panel.Import.superclass.constructor.call(this, config);
};
Ext.extend(ImportIt.panel.Import, MODx.FormPanel);
Ext.reg('importit-panel-import', ImportIt.panel.Import);

If I use the following line

Ext.extend(ImportIt.panel.Import, MODx.Panel);

or if I remove

xtype: 'radiogroup',

the CMP is rendered.

@alroniks alroniks added the bug The issue in the code or project, which should be addressed. label Sep 7, 2018
@Ibochkarev
Copy link
Collaborator

@Jako Can you fix it now?

@Jako
Copy link
Collaborator Author

Jako commented Feb 17, 2019

No, the issue is still there.

@sebastian-marinescu
Copy link
Contributor

Hi @Jako, out of curiosity, does it work now? 🤓

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug The issue in the code or project, which should be addressed.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants