Skip to content

Change event not firing on nested grids (resize, move...) #2671

Closed

Description

@ddowie

Hi,

does "change" event work on nested grid items?
In my situation change event is triggered only when moving or resizing parent (1st level) grid items.

Steps to reproduce

var items = [{"x":0,"y":0,"w":6,"id":"5352223231011-3142222-410151-132321-200104202021152022100","subGridOpts":{"children":[]}},{"x":6,"y":0,"w":6,"id":"133014223145-112141-4112121-120214-43422114222221410","subGridOpts":{"children":[{"id":"01344140020-1013320-4151323-1521411-1140103111252101411","subGridOpts":{"children":[]},"x":0,"y":0},{"id":"412141422121-102202-42145-12152321-5223321101112214225","subGridOpts":{"children":[]},"x":3,"y":0}]}},{"x":0,"y":1,"w":12,"id":"1122021332120-2201014-4151315-1521145-12102130152142222321","subGridOpts":{"children":[]}}];

let options = { // main grid options
    resizable: {
        handles: 'se'
    },
    margin: 8,
    minRow: 2, // don't collapse when empty
    acceptWidgets: true,
    subGridDynamic: false,
    subGridOpts: subOptions // all sub grids will default to those
};


var grid = GridStack.init(options);
grid.load(items);

grid.on('change', function (event, el) {
      serializeFullGrid(grid);
  });

Activity

  1. adumesny commented on Apr 30, 2024

    @adumesny
    Member

    events are currently per grid and don't bubble up when nested. that is a feature request if you want to donate for it.

  2. added 2 commits that reference this issue on Apr 24, 2025
    8d8ba15
    acbc895
  3. adumesny commented on Apr 24, 2025

    @adumesny
    Member

    fixed in v12.1 - don't forget to donate if you fid this lib useful!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions