octobercms/october · error · Error

The required data-data attribute is not found on the table…

Error message

The required data-data attribute is not found on the table control element.

What it means

Constructor guard in the client data source: the table control's DOM element lacks the required data-data attribute, which is where the widget receives its initial client-side records payload. Without it there is no dataset to operate on.

Solutions

  1. Render the table element with a data-data attribute containing the JSON records
  2. When using the Table widget PHP class, pass the records so the backend renders the data-data attribute
  3. Ensure the JSON in the attribute is well-formed and HTML-escaped
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at modules/backend/widgets/table/assets/js/table.datasource.client.js:27 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of octobercms/october@b608633a7e (2026-08-21). Data as JSON: /api/errors/837ba76e7b5911b9. Report an issue: GitHub.

Appendix: source

Thrown at modules/backend/widgets/table/assets/js/table.datasource.client.js:27

    if ($.oc.table === undefined)
        throw new Error("The $.oc.table namespace is not defined. Make sure that the table.js script is loaded.");

    if ($.oc.table.datasource === undefined)
        throw new Error("The $.oc.table.datasource namespace is not defined. Make sure that the table.datasource.base.js script is loaded.");

    // CLASS DEFINITION
    // ============================

    var Base = $.oc.table.datasource.base,
        BaseProto = Base.prototype

    var Client = function(tableObj) {
        Base.call(this, tableObj)

        var dataString = tableObj.getElement().getAttribute('data-data')

        if (dataString === null || dataString === undefined)
            throw new Error('The required data-data attribute is not found on the table control element.')

        this.data = JSON.parse(dataString)
    };

    Client.prototype = Object.create(BaseProto)
    Client.prototype.constructor = Client

    Client.prototype.dispose = function() {
        BaseProto.dispose.call(this)
        this.data = null
    }

    /*
     * Fetches records from the underlying data source and
     * passes them to the onSuccess callback function.
     * The onSuccess callback parameters: records, totalCount.
     * Each record contains the key field which uniquely identifies 
     * the record. The name of the key field is defined with the table 

View on GitHub (pinned to b608633a7e)