简体   繁体   English

未被捕获的TypeError:binding.destroy不是ExtJs 5中的函数

[英]Uncaught TypeError: binding.destroy is not a function in ExtJs 5

I am using Ext.util.StoreHolder mixin in my extjs 5.1 view.I found problem with Ext.destroy() method which throws error while destroying view having bindable mixin Ext.util.StoreHolder . 我在extjs 5.1视图中使用Ext.util.StoreHolder mixin。我发现Ext.destroy()方法存在问题, Ext.destroy()方法在破坏具有可绑定的mixin Ext.util.StoreHolder的视图时引发错误。 I can not destroy that view, it giving me error 我无法破坏这种观点,这给了我错误

Uncaught TypeError: binding.destroy is not a function 未被捕获的TypeError:binding.destroy不是函数

at Ext.define.privates.removeBindings 在Ext.define.privates.removeBindings

My view is using mixin: 我的看法是使用mixin:

mixins: {
    bindable: 'Ext.util.StoreHolder'
},

Is there any problem with Ext.util.StoreHolder mixin? Ext.util.StoreHolder mixin有问题吗? Why can't I destroy that view? 我为什么不能破坏那个观点?

Edit -> , please find my code 编辑->,请找到我的代码

Ext.define('MyApp.view.ux.CustomPagingBar', {
    extend: 'Ext.toolbar.Toolbar',
    alias : 'widget.custompagingbar',
    mixins: {
        bindable: 'Ext.util.StoreHolder'
    }
});

错误堆栈

Find Fiddle here Grid with Paging bar destroy issue 在此处找到小提琴, 使用分页栏破坏问题

Make sure that you are unbinding the store when destroy is called on the view. 当在视图上调用destroy时,请确保您解除绑定存储。

I think this should work. 我认为这应该有效。

Ext.define('MyApp.view.ux.CustomPagingBar' ,{
   extend: 'Ext.toolbar.Toolbar',
   alias : 'widget.custompagingbar',
   mixins: {
      bindable: 'Ext.util.StoreHolder'
  },

  // other code

  onDestroy: function(){
      var me = this;
        me.bindStore(null);
        // some other custom code if you want
        me.callParent();
    }


});

    // me.bindStore(null); this will unbind the store from the view before it is destroyed

In Ext JS 5, Ext.mixin.Bindable has a new config--"bind"-- which allows bind descriptors to be defined on components. 在Ext JS 5中, Ext.mixin.Bindable has a new config--"bind"--该配置允许在组件上定义绑定描述符。

In my component's "bind" method is overwriting this, and so the binding cleanup process is trying to destroy a binding, but doesn't have the proper configuration for it. 在我组件的“ bind”方法中覆盖了此方法,因此绑定清理过程试图破坏绑定,但没有适当的配置。

Commenting "bind" method prevent the destroy issue. 注释“绑定”方法可防止破坏问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM