2016-03-09 49 views
0

阿爾法酒吧和文字我使用this從colorfield選擇挑選顏色。但是,我不希望alpha欄可用和可見。我如何從我的概述中隱藏這個?這似乎是一個簡單的問題,但我真的不知道答案。ExtJS的隱藏colorfield

回答

3

如果重寫類,或將其延伸到自己的組件和改變構造函數如下:

constructor: function (config) { 
    var me    = this, 
     childViewModel = Ext.Factory.viewModel('colorpick-selectormodel'); 

    // Since this component needs to present its value as a thing to which users can 
    // bind, we create an internal VM for our purposes. 
    me.childViewModel = childViewModel; 
    me.items = [ 
     me.getMapAndHexRGBFields(childViewModel), 
     me.getSliderAndHField(childViewModel), 
     me.getSliderAndSField(childViewModel), 
     me.getSliderAndVField(childViewModel), 
     /* remove this one as it is the alpha field */ 
     //me.getSliderAndAField(childViewModel), 
     me.getPreviewAndButtons(childViewModel, config) 
    ]; 

    me.callParent(arguments); 
}, 
+0

重寫應該工作,但不是很理想,因爲你可能想在其他情況下。 如果擴展,當你調用callParent父類將覆蓋配置()。 –