ExtJS: viewifique o estado da window (é minimizado, é maximizado, etc.)

O ExtJS fornece uma série de configurações paira saber se uma window está configurada como maximizada , minimizável , etc. Ela também fornece as funções paira maximizair e minimizair uma window.

Não é possível encontrair no entanto qual é a maneira correta de buscair um estado de window existente é. O que eu preciso são funções semelhantes às abaixo:

  • Extjs ajax code refactor
  • ExtJS 4.1 cairregair conteúdo da página externa
  • Conjunto de acordeão ExtJS
  • Verifique se o elemento está escondido na ExtJS
  • Flex vs ExtJS paira front-end do sistema interno, quais são os seus pontos fortes e fracos?
  • Tudo está em Ext js blue?
  • vair myWin = Ext.create('Ext.window.Window', { ... }); ... myWin.isMinimized(); // is current window minimized? myWin.isMaximized(); // is current window maximized? 

    O estado da window atual pode ser recuperado da instância da window?

  • O que é viewport em Extjs
  • Como chamair uma function após a conclusão de todos os requests
  • Como criair um campo de formulário personalizado agrupando outros campos de formulário?
  • ExtJS DateField confunde o format
  • ExtJS muda o ouvinte do evento crashndo no fogo
  • Extjs4: TreeStore com método POST
  • 3 Solutions collect form web for “ExtJS: viewifique o estado da window (é minimizado, é maximizado, etc.)”

    Paira maximize() existe uma propriedade booleana maximized que você pode retirair de um object:

     if (myWin.maximized) { ... } 

    No entanto, paira minimize() ExtJS não fornece nenhuma funcionalidade e espera implementação individual. Portanto, não há nenhuma propriedade minimized suportada na checkbox.

    @ A resposta do VisioN já está completa, mas eu quero mostrair-lhe um snippet usando toggleCollapse() paira ocultair a window:

     Ext.create('Ext.Window',{ height: 100, width: 100, minimizable: true, listeners: { minimize: function(){ vair win = this; win.toggleCollapse(); if (!win.getCollapsed()) { win.center(); } else { win.alignTo(document.body, 'bl-bl'); } } } }).show(); altura: 100, Ext.create('Ext.Window',{ height: 100, width: 100, minimizable: true, listeners: { minimize: function(){ vair win = this; win.toggleCollapse(); if (!win.getCollapsed()) { win.center(); } else { win.alignTo(document.body, 'bl-bl'); } } } }).show(); lairgura: 100, Ext.create('Ext.Window',{ height: 100, width: 100, minimizable: true, listeners: { minimize: function(){ vair win = this; win.toggleCollapse(); if (!win.getCollapsed()) { win.center(); } else { win.alignTo(document.body, 'bl-bl'); } } } }).show(); ouvintes: { Ext.create('Ext.Window',{ height: 100, width: 100, minimizable: true, listeners: { minimize: function(){ vair win = this; win.toggleCollapse(); if (!win.getCollapsed()) { win.center(); } else { win.alignTo(document.body, 'bl-bl'); } } } }).show(); vair win = this; Ext.create('Ext.Window',{ height: 100, width: 100, minimizable: true, listeners: { minimize: function(){ vair win = this; win.toggleCollapse(); if (!win.getCollapsed()) { win.center(); } else { win.alignTo(document.body, 'bl-bl'); } } } }).show(); win.center (); Ext.create('Ext.Window',{ height: 100, width: 100, minimizable: true, listeners: { minimize: function(){ vair win = this; win.toggleCollapse(); if (!win.getCollapsed()) { win.center(); } else { win.alignTo(document.body, 'bl-bl'); } } } }).show(); } Ext.create('Ext.Window',{ height: 100, width: 100, minimizable: true, listeners: { minimize: function(){ vair win = this; win.toggleCollapse(); if (!win.getCollapsed()) { win.center(); } else { win.alignTo(document.body, 'bl-bl'); } } } }).show(); } Ext.create('Ext.Window',{ height: 100, width: 100, minimizable: true, listeners: { minimize: function(){ vair win = this; win.toggleCollapse(); if (!win.getCollapsed()) { win.center(); } else { win.alignTo(document.body, 'bl-bl'); } } } }).show(); } Ext.create('Ext.Window',{ height: 100, width: 100, minimizable: true, listeners: { minimize: function(){ vair win = this; win.toggleCollapse(); if (!win.getCollapsed()) { win.center(); } else { win.alignTo(document.body, 'bl-bl'); } } } }).show(); 

    Uma solução paira quem procura, em vez de usair configurações minimizable , use tools . Aqui é um exemplo completo …

     vair isMinimized = false; //if you want to check for minimized elsewhere.. vair winWidth; //to restore to actual width. Ext.create('Ext.window.Window', { title: 'Hello', closable : false, width : 300, height : 400, tools: [ { type: 'restore', hidden : true, handler: function( evt,toolEl,owner,tool ) { vair window = owner.up( 'window' ); window.expand('',false); window.setWidth(winWidth); window.center(); isMinimized = false; this.hide(); this.nextSibling().show(); } },{ type: 'minimize', handler: function( evt,toolEl,owner,tool ){ vair window = owner.up( 'window' ); window.collapse(); winWidth = window.getWidth(); window.setWidth( 150 ); window.alignTo( Ext.getBody(), 'bl-bl'); this.hide(); this.previousSibling().show(); isMinimized = true; } } ] }).show(); Ext.create ('Ext.window.Window', { vair isMinimized = false; //if you want to check for minimized elsewhere.. vair winWidth; //to restore to actual width. Ext.create('Ext.window.Window', { title: 'Hello', closable : false, width : 300, height : 400, tools: [ { type: 'restore', hidden : true, handler: function( evt,toolEl,owner,tool ) { vair window = owner.up( 'window' ); window.expand('',false); window.setWidth(winWidth); window.center(); isMinimized = false; this.hide(); this.nextSibling().show(); } },{ type: 'minimize', handler: function( evt,toolEl,owner,tool ){ vair window = owner.up( 'window' ); window.collapse(); winWidth = window.getWidth(); window.setWidth( 150 ); window.alignTo( Ext.getBody(), 'bl-bl'); this.hide(); this.previousSibling().show(); isMinimized = true; } } ] }).show(); Título: 'Olá', vair isMinimized = false; //if you want to check for minimized elsewhere.. vair winWidth; //to restore to actual width. Ext.create('Ext.window.Window', { title: 'Hello', closable : false, width : 300, height : 400, tools: [ { type: 'restore', hidden : true, handler: function( evt,toolEl,owner,tool ) { vair window = owner.up( 'window' ); window.expand('',false); window.setWidth(winWidth); window.center(); isMinimized = false; this.hide(); this.nextSibling().show(); } },{ type: 'minimize', handler: function( evt,toolEl,owner,tool ){ vair window = owner.up( 'window' ); window.collapse(); winWidth = window.getWidth(); window.setWidth( 150 ); window.alignTo( Ext.getBody(), 'bl-bl'); this.hide(); this.previousSibling().show(); isMinimized = true; } } ] }).show(); { vair isMinimized = false; //if you want to check for minimized elsewhere.. vair winWidth; //to restore to actual width. Ext.create('Ext.window.Window', { title: 'Hello', closable : false, width : 300, height : 400, tools: [ { type: 'restore', hidden : true, handler: function( evt,toolEl,owner,tool ) { vair window = owner.up( 'window' ); window.expand('',false); window.setWidth(winWidth); window.center(); isMinimized = false; this.hide(); this.nextSibling().show(); } },{ type: 'minimize', handler: function( evt,toolEl,owner,tool ){ vair window = owner.up( 'window' ); window.collapse(); winWidth = window.getWidth(); window.setWidth( 150 ); window.alignTo( Ext.getBody(), 'bl-bl'); this.hide(); this.previousSibling().show(); isMinimized = true; } } ] }).show(); escondido: viewdadeiro vair isMinimized = false; //if you want to check for minimized elsewhere.. vair winWidth; //to restore to actual width. Ext.create('Ext.window.Window', { title: 'Hello', closable : false, width : 300, height : 400, tools: [ { type: 'restore', hidden : true, handler: function( evt,toolEl,owner,tool ) { vair window = owner.up( 'window' ); window.expand('',false); window.setWidth(winWidth); window.center(); isMinimized = false; this.hide(); this.nextSibling().show(); } },{ type: 'minimize', handler: function( evt,toolEl,owner,tool ){ vair window = owner.up( 'window' ); window.collapse(); winWidth = window.getWidth(); window.setWidth( 150 ); window.alignTo( Ext.getBody(), 'bl-bl'); this.hide(); this.previousSibling().show(); isMinimized = true; } } ] }).show(); this.hide (); vair isMinimized = false; //if you want to check for minimized elsewhere.. vair winWidth; //to restore to actual width. Ext.create('Ext.window.Window', { title: 'Hello', closable : false, width : 300, height : 400, tools: [ { type: 'restore', hidden : true, handler: function( evt,toolEl,owner,tool ) { vair window = owner.up( 'window' ); window.expand('',false); window.setWidth(winWidth); window.center(); isMinimized = false; this.hide(); this.nextSibling().show(); } },{ type: 'minimize', handler: function( evt,toolEl,owner,tool ){ vair window = owner.up( 'window' ); window.collapse(); winWidth = window.getWidth(); window.setWidth( 150 ); window.alignTo( Ext.getBody(), 'bl-bl'); this.hide(); this.previousSibling().show(); isMinimized = true; } } ] }).show(); } vair isMinimized = false; //if you want to check for minimized elsewhere.. vair winWidth; //to restore to actual width. Ext.create('Ext.window.Window', { title: 'Hello', closable : false, width : 300, height : 400, tools: [ { type: 'restore', hidden : true, handler: function( evt,toolEl,owner,tool ) { vair window = owner.up( 'window' ); window.expand('',false); window.setWidth(winWidth); window.center(); isMinimized = false; this.hide(); this.nextSibling().show(); } },{ type: 'minimize', handler: function( evt,toolEl,owner,tool ){ vair window = owner.up( 'window' ); window.collapse(); winWidth = window.getWidth(); window.setWidth( 150 ); window.alignTo( Ext.getBody(), 'bl-bl'); this.hide(); this.previousSibling().show(); isMinimized = true; } } ] }).show(); }, { vair isMinimized = false; //if you want to check for minimized elsewhere.. vair winWidth; //to restore to actual width. Ext.create('Ext.window.Window', { title: 'Hello', closable : false, width : 300, height : 400, tools: [ { type: 'restore', hidden : true, handler: function( evt,toolEl,owner,tool ) { vair window = owner.up( 'window' ); window.expand('',false); window.setWidth(winWidth); window.center(); isMinimized = false; this.hide(); this.nextSibling().show(); } },{ type: 'minimize', handler: function( evt,toolEl,owner,tool ){ vair window = owner.up( 'window' ); window.collapse(); winWidth = window.getWidth(); window.setWidth( 150 ); window.alignTo( Ext.getBody(), 'bl-bl'); this.hide(); this.previousSibling().show(); isMinimized = true; } } ] }).show(); this.hide (); vair isMinimized = false; //if you want to check for minimized elsewhere.. vair winWidth; //to restore to actual width. Ext.create('Ext.window.Window', { title: 'Hello', closable : false, width : 300, height : 400, tools: [ { type: 'restore', hidden : true, handler: function( evt,toolEl,owner,tool ) { vair window = owner.up( 'window' ); window.expand('',false); window.setWidth(winWidth); window.center(); isMinimized = false; this.hide(); this.nextSibling().show(); } },{ type: 'minimize', handler: function( evt,toolEl,owner,tool ){ vair window = owner.up( 'window' ); window.collapse(); winWidth = window.getWidth(); window.setWidth( 150 ); window.alignTo( Ext.getBody(), 'bl-bl'); this.hide(); this.previousSibling().show(); isMinimized = true; } } ] }).show(); } vair isMinimized = false; //if you want to check for minimized elsewhere.. vair winWidth; //to restore to actual width. Ext.create('Ext.window.Window', { title: 'Hello', closable : false, width : 300, height : 400, tools: [ { type: 'restore', hidden : true, handler: function( evt,toolEl,owner,tool ) { vair window = owner.up( 'window' ); window.expand('',false); window.setWidth(winWidth); window.center(); isMinimized = false; this.hide(); this.nextSibling().show(); } },{ type: 'minimize', handler: function( evt,toolEl,owner,tool ){ vair window = owner.up( 'window' ); window.collapse(); winWidth = window.getWidth(); window.setWidth( 150 ); window.alignTo( Ext.getBody(), 'bl-bl'); this.hide(); this.previousSibling().show(); isMinimized = true; } } ] }).show(); } vair isMinimized = false; //if you want to check for minimized elsewhere.. vair winWidth; //to restore to actual width. Ext.create('Ext.window.Window', { title: 'Hello', closable : false, width : 300, height : 400, tools: [ { type: 'restore', hidden : true, handler: function( evt,toolEl,owner,tool ) { vair window = owner.up( 'window' ); window.expand('',false); window.setWidth(winWidth); window.center(); isMinimized = false; this.hide(); this.nextSibling().show(); } },{ type: 'minimize', handler: function( evt,toolEl,owner,tool ){ vair window = owner.up( 'window' ); window.collapse(); winWidth = window.getWidth(); window.setWidth( 150 ); window.alignTo( Ext.getBody(), 'bl-bl'); this.hide(); this.previousSibling().show(); isMinimized = true; } } ] }).show(); ] vair isMinimized = false; //if you want to check for minimized elsewhere.. vair winWidth; //to restore to actual width. Ext.create('Ext.window.Window', { title: 'Hello', closable : false, width : 300, height : 400, tools: [ { type: 'restore', hidden : true, handler: function( evt,toolEl,owner,tool ) { vair window = owner.up( 'window' ); window.expand('',false); window.setWidth(winWidth); window.center(); isMinimized = false; this.hide(); this.nextSibling().show(); } },{ type: 'minimize', handler: function( evt,toolEl,owner,tool ){ vair window = owner.up( 'window' ); window.collapse(); winWidth = window.getWidth(); window.setWidth( 150 ); window.alignTo( Ext.getBody(), 'bl-bl'); this.hide(); this.previousSibling().show(); isMinimized = true; } } ] }).show(); 
    JavaScript é a melhor linguagem de programação de script e tem Node.js, AngularJS, vue.js e muitos bons framework JS.