2013-12-10 51 views
0

我正在開發一個extjs項目。我有幾頁可能有不同的佈局。擁有不同的視口是一個好主意,或者最好在應用程序中使用一個視口並更改組件。謝謝。使用Extjs的最佳實踐

+0

的代碼重用是最好的做法在任何軟件,Ext JS的包括在內。因此,除非您的視口在頁面之間有所區別,否則重複使用同一個類似乎是理想之選。 – existdissolve

+0

感謝您的意見,我發現卡布局是正確的方法來解決,而不是使用多個視口 – cheftao

回答

0

每當我我只能使用1視通常有一個邊界佈局,我可以把和刪除組件並改變它們的佈局,但是當我有我的應用程序不同的切入點...

比方說,你有一個應用程序是客戶和員工應該訪問的銷售商店,在那種情況下你會做什麼?

我認爲當您有不同的入口點,根據業務規則呈現不同的組件時,多個視口也會派上用場。

SalesApp 
    app 
     model 
     view 
     controller 
     store 
    employees.html //includes employees.js 
    customers.html //includes customers.js 
    employees.js  //includes all views, models controllers and stores required 
    customers.js  //... 

內employees.js,你會創建視這樣的:

Ext.application({ 
    requires: ['Ext.container.Viewport'], 
    name: 'RCV2', 
    appFolder: 'app', 
    controllers: [], 
    views: [ 
     "ReporteConcentradoGrid", 
     "ParametrosReporteConcentradoForm" 
    ], 
    stores: [ 
      "ReporteConcentradoStore" 
    ], 
    model: [ 
      "RegistroReporteConcentrado" 

    ], 
    launch: function() { 

     Ext.create("Ext.container.Viewport",{ 
      layout: 'border', 
      items:[ 
        { 
         xtype: 'prcf', 
         title: 'Filtros', 
         region: 'north', 
         height: 100  
        }, 
        { 
         xtype: 'reporteconcentradogrid', 
         region: 'center' 
        } 

        ] 
     }); 
    } 
});