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

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

Closed
stenhro opened this issue Feb 27, 2020 · 2 comments

Comments

@stenhro
Copy link

stenhro commented Feb 27, 2020

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.

@stenhro stenhro changed the title grid.on("added change removed", function(e, items)) { ... } not working: items is undefined grid.on("added change removed", function(e, items)) { ... }); not working: items is undefined Feb 27, 2020
@stenhro stenhro changed the title grid.on("added change removed", function(e, items)) { ... }); not working: items is undefined grid.on("added change removed", function(e, items) { ... }); not working: items is undefined Feb 27, 2020
@adumesny
Copy link
Member

would be good to fix to support legacy code (jquery did handle it). Down side is that once we switch to Typescript, you can't enforce a concatenated list of known items...

@adumesny
Copy link
Member

fixed in next release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants