partkeepr

fork of partkeepr
git clone https://git.e1e0.net/partkeepr.git
Log | Files | Refs | Submodules | README | LICENSE

Ext.layout.component.field.Trigger-theme.js (1096B)


      1 /**
      2  * Enhancements for Ext.layout.component.field.Trigger:
      3  * 
      4  * Adjust the rendering so our custom theme works pretty.
      5  */
      6 Ext.override(Ext.layout.component.field.Trigger, {
      7     sizeBodyContents: function(width, height) {
      8         var me = this,
      9             owner = me.owner,
     10             inputEl = owner.inputEl,
     11             triggerWrap = owner.triggerWrap,
     12             triggerWidth = owner.getTriggerWidth();
     13 
     14         // If we or our ancestor is hidden, we can get a triggerWidth calculation
     15         // of 0.  We don't want to resize in this case.
     16         if (owner.hideTrigger || owner.readOnly || triggerWidth > 0) {
     17             // Decrease the field's width by the width of the triggers. Both the field and the triggerWrap
     18             // are floated left in CSS so they'll stack up side by side.
     19             me.setElementSize(inputEl, Ext.isNumber(width) ? width  : width);
     20     
     21             inputEl.dom.style.paddingRight = (triggerWidth+2)+"px";
     22             // Explicitly set the triggerWrap's width, to prevent wrapping
     23             triggerWrap.setWidth(triggerWidth);
     24         }
     25     }
     26 });