Golden-layout: How to catch the GoldenLayout tab maximise Event..?

Created on 13 Mar 2018  路  7Comments  路  Source: golden-layout/golden-layout

Hi,
am unable to find the maximise event trigger can someone help on these please

Most helpful comment

Easiest way to capture maximise/ minimize events is to attach a click method on stack creation, example code will look like below

myLayout.on( 'stackCreated', function( stack ){
    stack
        .header
        .controlsContainer
        .find( '.lm_maximise' ) //get the maximise icon
        .click(function(){
          //Get maximise and minimise events here
        });
});

All 7 comments

I think a lot of events aren't documented, so in that case the best approach is to search inside goldenlayout.js for .emit, and you can find all the events that are triggered throughout the library.

In this case, I found the maximised event, which is triggered on the stack which is maximised. Hope that helps!

Easiest way to capture maximise/ minimize events is to attach a click method on stack creation, example code will look like below

myLayout.on( 'stackCreated', function( stack ){
    stack
        .header
        .controlsContainer
        .find( '.lm_maximise' ) //get the maximise icon
        .click(function(){
          //Get maximise and minimise events here
        });
});

Thank you Ram Yadlapalli Its Working

@Raviraj531 , Please close the issue if it is resolved

@asialgearoid maximised event is package private.

Maximising a tab throws stateChangedevent, so you could listen to this or attach your own clickListener like @RamYadlapalli suggested.

@malled I've implemented the solution, for click of close icon, as suggested by @RamYadlapalli
However that code is getting called multiple times equals to number of stack present in the GL. If there are 4 stacks, clicking on close button on any of the stack call the clickListener code 4 times.

What worked for me was this ...

      myLayout.on("stackCreated", (stack) => {
        const maximizeElement = stack.element.find(".lm_maximise")[0];
        stack.on("maximised", () => {
          console.log("is maximized here");
        });

        stack.on("minimised", () => {
          console.log("is minimized here");
        });
      });
Was this page helpful?
0 / 5 - 0 ratings

Related issues

panyam picture panyam  路  4Comments

martin31821 picture martin31821  路  3Comments

ldetomi picture ldetomi  路  5Comments

mathpaquette picture mathpaquette  路  8Comments

lstkz picture lstkz  路  5Comments