2011-11-01 108 views
2

我有一个可调整大小的extjs面板。我需要在调整大小事件后计算面板的x和y位置。到目前为止,我已经做到了这一点Extjs面板resizer-调整大小后

Panel.resizer = new Ext.Resizable(Panel.el, { 
animate: true, 
       duration: '.6', 
       easing: 'backIn', 
       handles: 'all', 
       constrainTo: 'dropBoxWindow', 
       pinned: false, 
       transparent: true 
      }); 
     Panel.resizer.on("resize", function (oResizable, iWidth, iHeight, e) { 
console.log(panel.el.getX()); // getting the x position before the resize..need to get position after resize. 
      Panel.setHeight(iHeight); 
      Panel.setWidth(iWidth); 
     }, this); 

有人可以帮助我解决这个

回答

2

我不知道究竟你正在努力实现这一代码。我创建js fiddle演示“调整大小”面板(带动画过渡),这是代码,我结束了:

new Ext.Panel({ 
    title: 'Resize me', 
    x: 100, 
    y: 100, 
    renderTo: Ext.getBody(), 
    floating: true, 
    frame: true, 
    width: 400, 
    height: 200, 
    listeners: { 
     render: function(p) { 
      new Ext.Resizable(p.getEl(), { 
       animate: true, 
       duration: '.6', 
       easing: 'backIn', 
       handles: 'all', 
       pinned: false, 
       transparent: true, 
       resizeElement: function() { 
        var box = this.proxy.getBox(); 
        if (this.updateBox) { 
         this.el.setBox(
         box, false, this.animate, this.duration, function() { 
          p.updateBox(box); 
          if (p.layout) { 
           p.doLayout(); 
          } 
         }, this.easing); 
        } else { 
         this.el.setSize(
         box.width, box.height, this.animate, this.duration, function() { 
          p.updateBox(box); 
          if (p.layout) { 
           p.doLayout(); 
          } 
         }, this.easing); 
        } 
        this.updateChildSize(); 
        if (!this.dynamic) { 
         this.proxy.hide(); 
        } 
        if (this.draggable && this.constrainTo) { 
         this.dd.resetConstraints(); 
         this.dd.constrainTo(this.constrainTo); 
        } 
        return box; 
       } 
      }); 
     } 
    } 
}); 

你并不需要调整大小后计算面板的位置,但如果你真的这样做需要这些信息对于您的自定义应用程序代码,您可以使用resizeElement函数中的box变量。

+1

为什么这个问题没有答案?这段代码对你有用吗? – sbgoran

+0

它的工作....... – prajeesh

相关问题