Skip to content

DG008: Two modules claim one slot ​

Thrown error
text
[datagrids DG008] Two modules claim the single `{slot}` slot (`{a}` and `{b}`).

This is a wiring mistake: the grid throws an Error with this message instead of half-working.

When it happens ​

Two modules claim the source slot, the only single slot. Every data source occupies it: serverSide, arraySource, domSource, fetchAll, customSource. Thrown when use contains two sources, or when a source is chained with grid.use() while an explicit one is already attached (a chained source replaces only the default array/DOM source). {a} is the source in place, {b} the one being attached.

How to fix it ​

Attach exactly one source, in use: [...] at construction:

js
new Datagrid("#agents", {
  label: "Agents",
  columns,
  use: [serverSide({ url: "/api/agents", protocol: yajra() })],
});

To switch sources, destroy() the grid and create a new one. Note that data: [...] is ignored, without an error, when use already contains a source.

Released under the MIT License.