1

[解决了]

我的 UI 中有三个网格。假设它们是 A,B,C

问题是我在网格之间添加了两个拆分器。我的网格 A 和 C 调整大小,但网格 B 是固定的。

    --------------------------
             A
    ---------------------------
             B
    ----------------------------
             C




--------------------------------
            A



---------------------------------
            B
---------------------------------


             C
---------------------------------

我不知道如何编写代码来解释:P

代码:

  layout:{
        type:'vbox',
        align:'stretch',
        pack:'start',
        split:true,
        collapsible:true
  },
  items:[{
        xtype:'panel',
        layout:'fit',
        minHeight:200,
        flex:0.3,
        items:[{
            // add some grid or panel
         }]
       },
       {
         xtype:'splitter',
       },
       {
        xtype:'panel',
        layout:'fit',
        flex:0.3,
        minHeight:200,
        items:[{
            // add some grid or panel
         }]
        },
        {
        xtype:'splitter',
        },
        {
        xtype:'panel',
        layout:'fit',
        flex:0.3,
        minHeight:200,
            items:[{
            // add some grid or panel
         }]
        }]

http://jsfiddle.net/8Zesp/178/

4

1 回答 1

2

在与我一起工作的人的帮助下,我们能够做到这一点。它在 jsfiddle 中工作,因为它没有运行正确的 extjs

这是拆分器代码(SplitterTracker)中的一个错误,可以通过覆盖修复它有一个硬编码的“getWidth()”,无论拆分器移动的实际方向如何。

我希望这可以帮助别人

Ext.override(Ext.resizer.SplitterTracker, {
    // Performs the actual resizing of the previous and next components
    performResize: function(e, offset) {
        var me        = this,
            splitter  = me.getSplitter(),
            orient    = splitter.orientation,
            prevCmp   = me.getPrevCmp(),
            nextCmp   = me.getNextCmp(),
            owner     = splitter.ownerCt,
            flexedSiblings = owner.query('>[flex]'),
            len       = flexedSiblings.length,
            i         = 0,
            dimension,
            size,
            totalFlex = 0;

      // BUGFIX here:
        var getSizeFunc = (orient === 'vertical') ? 'getWidth' : 'getHeight';

        // Convert flexes to pixel values proportional to the total pixel width of all flexes.
        for (; i < len; i++) {
            size = flexedSiblings[i][getSizeFunc]();
            totalFlex += size;
            flexedSiblings[i].flex = size;
        }

        offset = offset || me.getOffset('dragTarget');

        if (orient === 'vertical') {
            offset = offset[0];
            dimension = 'width';
        } else {
            dimension = 'height';
            offset = offset[1];
        }
        if (prevCmp) {
            size = me.prevBox[dimension] + offset;
            if (prevCmp.flex) {
                prevCmp.flex = size;
            } else {
                prevCmp[dimension] = size;
            }
        }
        if (nextCmp) {
            size = me.nextBox[dimension] - offset;
            if (nextCmp.flex) {
                nextCmp.flex = size;
            } else {
                nextCmp[dimension] = size;
            }
        }

        owner.updateLayout();
    }
});
于 2013-04-23T06:03:01.560 回答