Skip to content

JavaScript-Fehler in grid-editor.js: Uncaught TypeError: Cannot set properties of undefined (setting 'CType') #88

@pascaloberhaensli

Description

@pascaloberhaensli

Beim Bearbeiten von Gridelements in TYPO3 12.4.24 mit Gridelements 12.0.0 tritt folgender Fehler auf:

grid-editor.js:267 Uncaught TypeError: Cannot set properties of undefined (setting 'CType')
    at GridEditor.setAllowed (grid-editor.js:267)
    ...

Ursache ist, dass n.allowed in der Methode setAllowed nicht initialisiert ist. Ein Patch zur Absicherung könnte wie folgt aussehen:

setAllowed(t, e, o) {
    const n = this.getCell(e, o);
    if (!n) return false;
    if (typeof n.allowed !== 'object' || n.allowed === null) {
        n.allowed = { CType: "", list_type: "", tx_gridelements_backend_layout: "" };
    }
    n.allowed.CType = GridEditor.stripMarkup(t ? t : '*');
    return true;
}

Ähnliche Anpassungen sind für setDisallowed, setAllowedListTypes, etc. erforderlich

grid-editor.patched.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions