extjs:响应面板容器及其组件的所有更改的事件

发布于 2024-11-05 12:31:02 字数 351 浏览 1 评论 0原文

我有一个带有“autoscroll:true”配置的面板,它包含可折叠的字段集。我有一个图表,将根据该面板及其组件的变化重新绘制。

我想要做的是捕获所有这些“更改”事件,以便根据面板组件的位置正确设置图表。

我认为我需要捕获两种类型的事件:

1)面板滚动

这里如何在面板滚动结束时触发“afterscorll”事件?我用的是:Ext.getCmp("XX").body.on(afterScroll',function(){});但不起作用。

2)字段集展开/折叠

,我还想知道是否有一个统一的事件来捕获这些变化,无论是滚动还是从该面板中字段集的展开/折叠?那么我只需要调用它一次。

I have a panel with "autoscroll:true" configuration, and it contains collapsiable fieldsets. I have a graph which will be re-drawed based on changes in this panel and also from its components.

what i want to do is to caputre all these "change" events in order to properly set up the graph according to the positions of panel components.

i think there are two types of events i need to capture:

1) panel scroll

here how can I trigger the "afterscorll" event whle panel scroll ends? i used:Ext.getCmp("XX").body.on(afterScroll',function(){}); but doesnt work.

2) fieldset expand/collapse

and also I am wondering whether there is a unified event to capture these changes no matter from scrolling or from expand/collase of fieldsets in this panel? then i can only need to call it once.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

口干舌燥 2024-11-12 12:31:02

我不知道我的理解是否正确;您可以将事件冒泡给家长。我正在做很多情况,例如将字段中的事件更改为表单。

编辑:
这是一个简单的例子。刚刚输入并未经测试。但它会告诉你窍门。

MappingDialog = function(){
   return {
      init : function(){
         dialog = new Ext.Window({
            width:     200,
            height:    150,
            modal:     true,
            closable:  false,
            bubbleEvents: ['saveMapping'], // <- Array with events
            buttons: [{
               text:'Save',
               handler:function(){ this.fireEvent('saveMapping'); }
            }],
            listeners: {
               saveMapping : function() { // should not be called }
            }
         });

         this.addListener('saveMapping', this.saveData, this); // <- Attaching event to Parent (or hand through)
      },
      saveData : function(){ // <- implement eventhandling
         ... Save the data ...
      }
   }
};

I don't know if I got you right; You can bubble the events up to a parent. I am doing this many situations like with the change event on field to the form.

Edit:
Here is a simple exmaple. Just typed and untested. But it will show you the trick.

MappingDialog = function(){
   return {
      init : function(){
         dialog = new Ext.Window({
            width:     200,
            height:    150,
            modal:     true,
            closable:  false,
            bubbleEvents: ['saveMapping'], // <- Array with events
            buttons: [{
               text:'Save',
               handler:function(){ this.fireEvent('saveMapping'); }
            }],
            listeners: {
               saveMapping : function() { // should not be called }
            }
         });

         this.addListener('saveMapping', this.saveData, this); // <- Attaching event to Parent (or hand through)
      },
      saveData : function(){ // <- implement eventhandling
         ... Save the data ...
      }
   }
};
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文