Skip to content

grid.on("added change removed", function(e, items) { ... }); not working: items is undefined #1171

@stenhro

Description

@stenhro

Subject of the issue

grid.on("added change removed", function(e, items) { ... }); not working: items is undefined. Error that manifests for items: "Uncaught TypeError: Cannot read property 'length' of undefined"

Your environment

GridStack version: 1.0.0
Browser and its version: Chromium v80.0.3987.87

Steps to reproduce

Working jsfiddle demo: https://jsfiddle.net/0rpyh32u/1/

  1. Load page
  2. Try to move Widget 1, for example
  3. Check console output with F12 developer tools
  4. Error "Uncaught TypeError: Cannot read property 'length' of undefined" should be seen

Expected behaviour

items is defined and can be iterated through

Actual behaviour

items is undefined

Other notes

Discussed in Slack thread https://gridstackjs.slack.com/archives/C0LPPLXJR/p1582557973010800. Apparently, error rises due to the fact that grid.on(...) doesn't support multiple events as jQuery does.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions