jQWidgets Forums

jQuery UI Widgets Forums Angular jqxGrid – Angular – error on endupdate()

This topic contains 1 reply, has 2 voices, and was last updated by  Hristo 4 years, 4 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author

  • SCA Angular
    Participant

    Hi there,

    In our project we are facing an issue with jqxGrid that occurs the first time we try to render data in the Grid.

    The error goes like this:

    Cannot read property 'find' of undefined
    at c.<computed>._rendercolumheaders
    at c.<computed>.rendergridcontent
    at c.<computed>.resumeupdate
    at c.<computed>.endupdate
    at Object.push../node_modules/...

    The piece of code that raises the error is below.

    
        processMessages(elt) {
          if (elt.payload !== undefined && elt.dataServiceType === 'getHistoricalAlarms') {
            console.info('%c t4-setWidgetValues-A.MANAGER End', 'background: khaki');
            this.gridAlarmsManager.beginupdate();
            this.generateHistoricalRows(elt);
            this.gridAlarmsManager.endupdate();

    We receive a message in “elt” and invoking generateHistoricalRows we do all the corresponding data processing and grid formatting, columns hiding/showing and all the related stuff. Apparently this method generateHistoricalRows works correctly and in the endupdate() comes the error, that is why I’m asking here the question because we have no control about what endupdate() does.

    I also paste the generateHistoricalRows in case it helps:

    generateHistoricalRows(elt): any {
          let rows = [];
          let data = this.commonTasks.parseDataBigNumber(elt.payload);
          const device = this.commonTasks.searchDevice(this.informationModel, elt.deviceId);
    
          let exit = this.alarmManagerMethods.searchInDeviceList(this.devicesList, device);
          if(!exit){
            this.devicesList.push(device);
          }
          if(this.devicesList.length > 1){
            this.parentName = device.deviceFullName.replace('/' + device.deviceName, '');
            this.gridAlarmsManager.showcolumn('Device');
          }else{
            this.gridAlarmsManager.hidecolumn('Device');
            this.parentName = this.shortenInfounit(device.deviceFullName);
            this.fullParentName = device.deviceFullName;
          }
    
          let hidden = this.gridAlarmsManager.getcolumnproperty('Device', 'hidden');
          if(hidden === true){
            this.gridAlarmsManager.setcolumnproperty("Name", "width", "42%");
          }else{
            this.gridAlarmsManager.setcolumnproperty("Name", "width", "32%");
          }
    
          if(data.values.length !== 0) {
            for(let i = 0; i < data.values.length; i++){
              let valueAlarm      = data.values[i];
              let row             = {};
              let iobject         = null;
              let levelAndStatus  = null;
    
              if(data.values[0].hasOwnProperty('timerange')) {
                iobject = this.commonTasks.getIObjectsAlarms(device.IObjects, elt.IObjectId, device, valueAlarm.reference.timestamp);
              } else {
                iobject = this.commonTasks.getIObjectsAlarms(device.IObjects, elt.IObjectId, device, valueAlarm.timestamp);
              }
    
              const dataValue = this.alarmManagerMethods.searchDataValue(iobject.DataValues, elt.dataId);
              const dataAlarm = this.alarmManagerMethods.searchAlarmData(dataValue.AlarmsValues, elt.alarmId);
              let alarmName = iobject.IObjectFullName + '/' + dataAlarm.AlarmName;
    
              if(data.values[0].hasOwnProperty('timerange')) {
                
                levelAndStatus = this.alarmManagerMethods.getLevelAndStatus(valueAlarm.reference.status);
                // id provisional
                const rowId = this.commonTasks.formatDate_Common(valueAlarm.reference.timestamp.div(1000000))+''+
                levelAndStatus.level+''+
                levelAndStatus.status+''+
                dataAlarm.AlarmSeverityLevel+''+
                valueAlarm.reference.value;
    
                row['rowId']=rowId;
                row['LevelId'] = valueAlarm.reference.status;
                row['Value'] =  valueAlarm.reference.value;
                row['DateTime'] = this.commonTasks.formatDate_Common(valueAlarm.reference.timestamp.div(1000000));
              } else {
                
                levelAndStatus = this.alarmManagerMethods.getLevelAndStatus(valueAlarm.status);
                // id provisional
                const rowId = this.commonTasks.formatDate_Common(valueAlarm.timestamp.div(1000000))+''+
                levelAndStatus.level+''+
                levelAndStatus.status+''+
                dataAlarm.AlarmSeverityLevel+''+
                valueAlarm.value;
    
                row['rowId']=rowId;
                row['LevelId'] = valueAlarm.status;
                row['Value'] =  valueAlarm.value;
                row['DateTime'] = this.commonTasks.formatDate_Common(valueAlarm.timestamp.div(1000000));
              }
    
              row['Level'] = levelAndStatus.level;
              row['Severity'] = dataAlarm.AlarmSeverityLevel;
              row['Type'] = dataAlarm.AlarmClass.toUpperCase();
              row['Device'] = device.deviceName;
              row['DeviceFullName'] = device.deviceFullName;
              row['DeviceId'] = device.deviceId;
              row['Name'] = alarmName;
              row['Status'] = levelAndStatus.status;
              rows.push(row);
    
              // si hay uno por instancia de interes lo eliminamos ya que lo volveremos a meter junto a los demas
              const indexRow = this.gridAlarmsManager.getrows().findIndex(r=>r['rowId'] === row['rowId']);
              if (indexRow !== -1) {
                this.gridAlarmsManager.getrows().splice(indexRow,1);
              }
    
            }
          }
          this.gridAlarmsManager.addrow(null, rows, 'last');
          //console.log('this.gridAlarmsManager',this.gridAlarmsManager.getrows());
      }

    Hristo
    Participant

    Hello SCA Angular,

    Could you provide us with more details?
    It will be better if you could provide us with one simple example that demonstrates your case.
    Also, with steps to reproduce it.
    I look forward to hearing from you.

    Best Regards,
    Hristo Hristov

    jQWidgets team
    https://www.jqwidgets.com

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.