extjsextjs3extjs-grid

Reset one edited cell of grid



Solution

  • I found the Solution.

    hasUnsavedChanges: function() {
          var isCell_1modified = false;
          var isCell_2modified = false;
          var isCell_3modified = false;
          this.getParametersFormPanel().stopEditing();
          var rowIndex = this.getParametersFormPanel().getSelectionModel().lastActive;
          var storeDataRecoder = this.getParametersFormPanel().getStore().data.items[rowIndex];
          var modifiedRecord = this.getParametersFormPanel().getStore().getModifiedRecords()[0];
          if(storeDataRecoder && modifiedRecord){
            if(storeDataRecoder.data.recordID === modifiedRecord.data.recordID){
              if(modifiedRecord.modified.hasOwnProperty("Cell_1")){
                if (modifiedRecord.modified.Cell_1 == storeDataRecoder.data.Cell_1){
                  isCell_1modified = false;
                }else{
                  isCell_1modified = true;
                }
              }
              if(modifiedRecord.modified.hasOwnProperty("Cell_2")){
                if(modifiedRecord.modified.Cell_2 === storeDataRecoder.data.Cell_2){
                  isCell_2modified = false;
                }else{
                  isCell_2modified = true;
                }
              }
              if(modifiedRecord.modified.hasOwnProperty("Cell_3")){
                if(modifiedRecord.modified.Cell_3 === storeDataRecoder.data.Cell_3){
                  isCell_3modified = false;
                }else{
                  isCell_3modified = true;
                }
              }
            }
          }
    
          if((isCell_1modified || isCell_3modified || isCell_2modified) === false){
            if(this.getParametersFormPanel().getStore().getModifiedRecords()){
              this.getParametersFormPanel().getStore().getModifiedRecords().length = 0;
            }
          }
          return (isCell_1modified || isCell_3modified || isCell_2modified);
        }
        ```