[英]Uncaught TypeError: Cannot read property 'isSynchronized' of undefined
I have a problem with sorting my ExtJS grid.我在排序 ExtJS 网格时遇到问题。 I'm using Ext JS version 5.1.1.451.
我使用的是 Ext JS 版本 5.1.1.451。
The grid loads well but when I try to sort the columns I get the "Uncaught TypeError: Cannot read property 'isSynchronized' of undefined" error.网格加载良好,但是当我尝试对列进行排序时,出现“未捕获的类型错误:无法读取未定义的属性‘isSynchronized’”错误。
The method addCls
is triggered on mouse movement and when the error occures, me.getData()
returns undefined
, where me
is方法
addCls
在鼠标移动时触发,当错误发生时, me.getData()
返回undefined
, me
在哪里
constructor
$observableInitialized: true
component: constructor
config: Object
destroy: () {}
dom: null
el: null
events: Object
hasListeners: statics.prepareClass.HasListeners
id: "ext-quicktips-tip"
initConfig: () {}
initialConfig: Object
isDestroyed: true
lastBox: null
managedListeners: Array[0]
shadow: null
This is the addCls
method where the error occurs:这是发生错误的
addCls
方法:
addCls: function(names, prefix, suffix) {
var me = this,
elementData = me.getData(),
hasNewCls, dom, map, classList, i, ln, name;
if (!names) {
return me;
}
if (!elementData.isSynchronized) {
me.synchronize();
}
Has anyone encounter this problem before?有没有人遇到过这个问题? Is it a known issue or am I doing something wrong?
这是一个已知问题还是我做错了什么?
Thank you谢谢
I've overriden the handleMouseDown method and commented out the quick tips part. 我重写了handleMouseDown方法,并注释了快速提示部分。
Ext.override(Ext.dd.DragDropManager, {
handleMouseDown: function (e, oDD) {
var me = this,
xy, el;
me.isMouseDown = true;
//if (Ext.quickTipsActive) {
// Ext.tip.QuickTipManager.ddDisable();
//}
me.currentPoint = e.getPoint();
if (me.dragCurrent) {
me.handleMouseUp(e);
}
me.mousedownEvent = e;
me.currentTarget = e.getTarget();
me.dragCurrent = oDD;
el = oDD.getEl();
Ext.fly(el).setCapture();
xy = e.getXY();
me.startX = xy[0];
me.startY = xy[1];
me.offsetX = me.offsetY = 0;
me.deltaX = me.startX - el.offsetLeft;
me.deltaY = me.startY - el.offsetTop;
me.dragThreshMet = false;
}
});
If anyone has a better answer, post it and I will mark it if it's good. 如果有人有更好的答案,请将其发布,如果效果好,我会予以标记。
I was having this issue because I was rendering a different value based on some mappings I needed to load separately.我遇到这个问题是因为我根据需要单独加载的一些映射渲染了不同的值。 If the mappings weren't loaded into the viewmodel then the renderer seemed to fail with that error.
如果映射未加载到视图模型中,则渲染器似乎因该错误而失败。
I solved it with some checks for existence of what it needed:我通过一些检查来解决它是否存在它需要的东西:
// on the renderer for the column where I have a combobox editor field
renderer: function(value) {
var mappings = vm.get('ruleMapping')
if(!!mappings) {
var rule = _.find(mappings, ['id', value]
if(!!rule) {
return `<a href="${rule.link}>${rule.name}</a>"`
}
}
return 'Setting value'
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.