extjs750 拖拽動態布局組件dashboard用法和樣例
小編:管理員 586閱讀 2022.09.07
版本
7.5.0 classic
主要組件Ext.dashboard.Dashboard儀表板組件,可實現動態拖拽布局 主要配置項:
- parts 儀表板要使用的parts定義,使用鍵值對形式傳入parts.id和psrts.config的映射
- columnWidths 儀表板分列默認列寬數組
- defaultContent 默認的項目配置.
用于創建儀表板項目的組件工廠 主要配置項:
- viewTemplate 視圖模板創建儀表板項目配置的模板,模板的綁定值通過配置參數傳入,也可以通過displayForm傳入 默認值為:
{ collapsed: '{collapsed}', columnIndex: '{columnIndex}', id: '{id}', title: '{title}', height: '{height}' }復制
- displayForm 使用dashboard.addNew時觸發此函數,可以在此處處理配置參數,或通過彈窗等方式讓用戶輸入額外的配置參數 默認值為:
displayForm: function(instance, currentConfig, callback, scope) { callback.call(scope || this, {}); }復制樣例
- ViewPart 根據viewType配置項嵌入其他應用視圖或組件
Ext.define('MyApp.ViewPart', { extend: 'Ext.dashboard.Part', alias: 'part.view', viewTemplate: { header: false, layout: 'fit', items: [{ xtype: '{viewType}' }] }, displayForm: function (instance, currentConfig, callback, scope) { const me = this, title = instance ? '編輯視圖類型' : '添加視圖'; Ext.Msg.prompt(title, 'View type', function (btn, text) { if (btn === 'ok') { var config = { viewType: text }; callback.call(scope || me, config); } }, me, false, currentConfig ? currentConfig.viewType : ''); } });復制
- Dashboard
{ xtype: 'dashboard', columnWidths:[0.3,0.7], parts: { widget1: { viewTemplate: { // 一般視圖配置 title: 'Widget 1', html: 'Widget 1' } }, widget2: { viewTemplate: { title: 'Widget 2', html: 'Widget 2' } }, widget3: { viewTemplate: { title: 'Widget 3', html: 'Widget 3' } }, viewPart: { // 使用自定義的part工廠 type: 'view' } }, defaultContent: [{ type: 'widget1', //maps to the parts key columnIndex: 0 }, { type: 'widget3', columnIndex: 0 }, { type: 'widget2', columnIndex: 1 }, { type: 'viewPart', //maps to the parts key xtype: 'myview', columnIndex: 0 }] }復制
相關推薦
- ExtJs七(ExtJs Mvc創建ViewPort) 前言在4.1的時候,要先創建一個擴展于Ext.app.Application的類,然后用create創建它的實例來開始應用程序的。而在4.1.1,則可直接調用application方法開始執行應用程序,簡化了。調用application方法,其參數是一個配置對象,主要配置項有以下三個:name:用來…
- Hibernate Criterion 在查詢方法設計上能夠靈活的依據Criteria的特點來方便地進行查詢條件的組裝.Hibernate設計了CriteriaSpecification作為Criteria的父接口,以下提供了Criteria和DetachedCriteria.Criteria和DetachedCriteria的主要差別在于創建的形式不一樣,Criteria是在線的,所…