Fixes around render cache
This commit is contained in:
parent
514edb984f
commit
2408d4c5c0
|
@ -102,6 +102,8 @@ MenuView.prototype.setItems = function(items) {
|
||||||
if(this.complexItems) {
|
if(this.complexItems) {
|
||||||
this.itemFormat = this.itemFormat || '{text}';
|
this.itemFormat = this.itemFormat || '{text}';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.invalidateRenderCache();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -110,11 +112,19 @@ MenuView.prototype.getRenderCacheItem = function(index, focusItem = false) {
|
||||||
return item && item[focusItem ? 'focus' : 'standard'];
|
return item && item[focusItem ? 'focus' : 'standard'];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
MenuView.prototype.removeRenderCacheItem = function(index) {
|
||||||
|
delete this.renderCache[index];
|
||||||
|
};
|
||||||
|
|
||||||
MenuView.prototype.setRenderCacheItem = function(index, rendered, focusItem = false) {
|
MenuView.prototype.setRenderCacheItem = function(index, rendered, focusItem = false) {
|
||||||
this.renderCache[index] = this.renderCache[index] || {};
|
this.renderCache[index] = this.renderCache[index] || {};
|
||||||
this.renderCache[index][focusItem ? 'focus' : 'standard'] = rendered;
|
this.renderCache[index][focusItem ? 'focus' : 'standard'] = rendered;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
MenuView.prototype.invalidateRenderCache = function() {
|
||||||
|
this.renderCache = {};
|
||||||
|
};
|
||||||
|
|
||||||
MenuView.prototype.setSort = function(sort) {
|
MenuView.prototype.setSort = function(sort) {
|
||||||
if(this.sorted || !Array.isArray(this.items) || 0 === this.items.length) {
|
if(this.sorted || !Array.isArray(this.items) || 0 === this.items.length) {
|
||||||
return;
|
return;
|
||||||
|
@ -152,6 +162,8 @@ MenuView.prototype.removeItem = function(index) {
|
||||||
this.focusedItemIndex = Math.max(this.focusedItemIndex - 1, 0);
|
this.focusedItemIndex = Math.max(this.focusedItemIndex - 1, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.removeRenderCacheItem(index);
|
||||||
|
|
||||||
this.positionCacheExpired = true;
|
this.positionCacheExpired = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue