No se pueden leer las propiedades de null (leyendo 'insertAdjacentHTML') mientras se actualiza la tienda.
Estoy tratando de actualizar mi tienda manualmente cambiando algunos datos.
Aquí está mi código.
updateFieldData: function (selectedDRecord) { if (selectedDRecord.id != undefined || selectedDRecord.id != null) { let _this = this; let groupkey = sessionStorage.getItem('groupKey'); var rowExapnaderGridData = Ext.ComponentQuery.query('#' + groupkey)[0].getStore(); // this is my gridstore var tempStore = []; var salesRowData = rowExapnaderGridData.getData().items; for (var i = 0; i < salesRowData.length; i++) { tempStore.push(salesRowData[i].data); } for (var i = 0; i < tempStore.length; i++) { tempStore[i].value = "somevalue"; } rowExapnaderGridData.loadData(tempStore); } },Esto funciona bien durante la creación, pero cuando estoy actualizando recibo el siguiente error.
Uncaught TypeError: Cannot read properties of null (reading 'insertAdjacentHTML') at ctor.insertHtml (ext-all.js?_dc=1654269040829:20:911890) at ctor.doInsert (ext-all.js?_dc=1654269040829:20:481469) at ctor.append (ext-all.js?_dc=1654269040829:20:481393) at ctor.refresh (ext-all.js?_dc=1654269040829:20:1600777) at ctor.refresh (ext-all.js?_dc=1654269040829:20:1619324) at ctor.refresh (ext-all.js?_dc=1654269040829:20:1862004) at ctor.refreshView (ext-all.js?_dc=1654269040829:20:1609433) at ctor.onDataRefresh (ext-all.js?_dc=1654269040829:20:1609149) at ctor.onDataRefresh (ext-all.js?_dc=1654269040829:20:1870226) at ctor.fire (ext-all.js?_dc=1654269040829:20:153709)Revisé en otros lugares pero no obtuve mucho apoyo wrtExtJS.
El código se puede simplificar así:
if (!Ext.isEmpty(selectedDRecord.id)) { const groupkey = sessionStorage.getItem('groupKey'), rowExpanderGridData = Ext.ComponentQuery.query('#' + groupkey)[0].getStore(); Ext.each(rowExpanderGridData, function(record) { record.set('fieldname', 'some value'); //'fieldname' is the field that you want to change; 'some value' the new value for it }); rowExpanderGridData.commitChanges(); } Alternativamente, puede crear una nueva matriz de modelos y cargarlos en la tienda usando loadRecords() .