max.each is not a functionAt least this function in Magento_Ui/js/dynamic-rows/dynamic-rows-grid.js needs prototypejs:
/**
* Check changed records
*
* @param {Array} data - array with records data
* @returns {Array} Changed records
*/
_checkGridData: function (data) {
var cacheLength = this.cacheGridData.length,
curData = data.length,
max = cacheLength > curData ? this.cacheGridData : data,
changes = [],
obj = {};
max.each(function (record, index) {
obj[this.map[this.identificationDRProperty]] = record[this.map[this.identificationDRProperty]];
if (!_.where(this.cacheGridData, obj).length) {
changes.push(data[index]);
}
}, this);
return changes;
}
Add a requirejs-config.js to your module which defines prototype as dependency:
var config = {
shim: {
'Magento_Ui/js/dynamic-rows/dynamic-rows-grid': {
deps: ['prototype']
}
'Magento_Ui/js/dynamic-rows/dynamic-rows': {
deps: ['prototype']
}
}
};
Add protoype as dependency to Magento_Ui/js/dynamic-rows/dynamic-rows.js:
define([
'ko',
'mageUtils',
'underscore',
'uiLayout',
'uiCollection',
'uiRegistry',
'mage/translate',
'prototype'
], function (ko, utils, _, layout, uiCollection, registry, $t) {
'use strict';
return uiCollection.extend({
defaults: {
defaultRecord: false,
columnsHeader: true,
columnsHeaderAfterRender: false,
columnsHeaderClasses: '',
labels: [],
Remove prototype legacy stuff completely.
This took me frustratingly long to discover.
see also http://alanstorm.com/magento-2-prototypejs-still-lurks/
@netzkollektiv , thank you for your report.
From your steps to reproduce we cannot completely understand how to reproduce issue. Please, give us your code source to reproduce this issue.
@netzkollektiv, we are closing this issue due to inactivity. If you'd like to update it, please reopen the issue.
Is this issue fixed? If not, why did you close it?
The steps are clear & easy to follow.
Even without reproducing this should be clear for a developer.
Was this ever fixed?
@tschirmer
They now use max.forEach instead of max.each, so I believe it is fixed.
But I did not have time yet to look back into it.
Most helpful comment
Is this issue fixed? If not, why did you close it?
The steps are clear & easy to follow.
Even without reproducing this should be clear for a developer.