2017-11-03 8 views
1

私はそうのような設定オプションでExt.window.Window minHeightプロパティを持つコンポーネントのプロパティおよびminWidthセットを持っている:ExtJS 4.0.5の設定オプション(minWidth)を変更するにはどうすればよいですか?

config: { 
     minWidth: 860, 
     minHeight: 580 
     }, 

は今、私はそうのような機能でこれらのプロパティを変更したい:

Ext.getCmp('x').setMinWidth(1280); 

そのSetterはまだExtJS 4.0.5には存在しません。

Ext.getCmp('x').config.minWidth = 1280; 

をそれはまた、動作しません。私もこれをやってみました

(それ以降のバージョンではそれはありません)。

ありがとうございます。

+0

いくつかの扇子を作成してください。 – Tejas

答えて

0

ExtJS Windowでは、設定値を変更した後にupdateLayoutメソッドを使用できます。

updateLayoutこのコンポーネントのレイアウトを更新します。この更新がこのコンポーネントownerCtに影響する場合、代わりにそのコンポーネントのupdateLayoutメソッドが呼び出されてレイアウトを実行します。それ以外の場合は、このコンポーネント(およびその子アイテム)だけがレイアウトされます。

ここではsencha fiddleデモを作成しました。それはどのように動作しているかを示します、これはあなたの問題を解決するか、あなたの要件を達成するのに役立つことを願っています。

Ext.create('Ext.window.Window', { 
    title: 'Hello', 
    minWidth: 400, 
    minHeight: 300, 
    layout: 'vbox', 
    items: [{ // Let's put an empty grid in just to illustrate fit layout 
     xtype: 'grid', 
     flex: 1, 
     width: '100%', 
     border: false, 
     store: { 
      fields: ['name', 'email', 'phone'], 
      data: { 
       'items': [{ 
        'name': 'Lisa', 
        "email": "[email protected]", 
        "phone": "555-111-1224" 
       }, { 
        'name': 'Bart', 
        "email": "[email protected]", 
        "phone": "555-222-1234" 
       }, { 
        'name': 'Homer', 
        "email": "[email protected]", 
        "phone": "555-222-1244" 
       }, { 
        'name': 'Marge', 
        "email": "[email protected]", 
        "phone": "555-222-1254" 
       }] 
      }, 
      proxy: { 
       type: 'memory', 
       reader: { 
        type: 'json', 
        root: 'items' 
       } 
      } 
     }, 
     columns: [{ 
      text: 'Name', 
      dataIndex: 'name' 
     }, { 
      text: 'Email', 
      dataIndex: 'email', 
      flex: 1 
     }, { 
      text: 'Phone', 
      dataIndex: 'phone' 
     }], 
    }, { 
     xtype:'button', 
     text: 'Update min height and width with Random Number', 
     height: 40, 
     margin: 10, 
     width:'100%', 
     renderTo: Ext.getBody(), 
     handler: function() { 
      /** 
      * Returns a random integer between min (inclusive) and max (inclusive) 
      * Using Math.round() will give you a non-uniform distribution! 
      */ 
      function getRandomInt(min, max) { 
       return Math.floor(Math.random() * (max - min + 1)) + min; 
      } 

      var num = getRandomInt(300, 600), 
       wind = this.up('window'); 
      wind.minHeight = num; 
      wind.minWidth = num; 
      wind.updateLayout(); 
     } 
    }] 
}).show(); 
+0

これは動作するようです。ウィンドウのサイズ変更は新しいminWidth&minHeightディメンションに制限されますが、 "サイズ変更プレビュー"(ウィンドウ境界を保持して内側にドラッグすると表示される破線)は、以前の "min"ディメンションまでドラッグできます。マウスの左ボタンを放すと、ウィンドウサイズは新しい "min"次元にスナップします。 問題を十分に説明できない場合は申し訳ありません。それはかなり大きなプロジェクトですので、私はそれをバイブルに分解するのは少し難しいです。 –

+0

私はちょうどチェックし、それはあなたの賢者のフィドルでも起こります。 minWidthまたはminHeightを増やした後も、サイズ変更プレビューで引き続きドラッグできます。 –

+0

申し訳ありませんが、実際には私はあなたを得ていませんでした。 –

関連する問題