gridstack.js icon indicating copy to clipboard operation
gridstack.js copied to clipboard

How to add Event Handlers to Nested Grids in Angular Gridstack

Open calebmgshort opened this issue 3 years ago • 2 comments

This isn't a bug so much as I'm trying to implement something and I haven't been able to figure out how to do it and I just want to know if it is possible / supported. All of the demos of gridstack only show event handlers being assigned to the top-level grid. In my case I use nested grids and I'm trying to add event handlers to all of them. I was able to do this in raw javascript using

    function addEventHandlers() {
      let gridEls = GridStack.getElements('.grid-stack');
      gridEls.forEach(gridEl => {
        let grid = gridEl.gridstack;
        addEvents(grid, grid.opts.id);
      })
    }

However, my application is angular and so that doesn't help. I can't search for all GridstackComponents because they are nested within eachother. Please let me know if I'm overlooking something or if there is some way to do this, other than just using the raw javascript Gridstack implementation and ignoring the Angular wrapper.

calebmgshort avatar Sep 21 '23 19:09 calebmgshort

I'm sorry just as I finished writing this I saw this question from yesterday: https://github.com/gridstack/gridstack.js/issues/2463#issue-1904623203 which I think is the same question

calebmgshort avatar Sep 21 '23 19:09 calebmgshort

yep dup of #2463

adumesny avatar Sep 21 '23 21:09 adumesny