Sunday 6 December 2020

Mutator in tabulator not working on same edited functions

I have a scenario where I am defining the below mutators when I edit the cell it doesnt works where common mutators are used? I guess this is a bug or is there any other way to do it ?

 var diffMutator_FEcontacted = function (value, data, type, params, component) {
    var start = moment(data.incident_start, 'DD/MM/YYYY HH:mm')                   
    var end = moment(data.First_expert_contacted_by_SE, 'DD/MM/YYYY HH:mm')       //common feild
    var new_value = end.diff(start, 'minutes');
    if (type == "edit") {
      console.log('edit');
      component.getRow().getCell("time_to_contact_first_exp_calc").setValue(new_value);
      return value;
    } else {
      return new_value
    }
  }

  var diffMutator_REcontacted = function (value, data, type, params, component) {
    var start = moment(data.incident_start, 'DD/MM/YYYY HH:mm')
    var end = moment(data.Right_expert_found_at, 'DD/MM/YYYY HH:mm') //common feild
    var new_value = end.diff(start, 'minutes');
    if (type == "edit") {
      console.log('edit');
      component.getRow().getCell("Time_to_find_right_exp_calc").setValue(new_value);
      return value;
    } else {
      return new_value
    }
  }

  var diffMutator_FEREdiff = function (value, data, type, params, component) {
    var start = moment(data.First_expert_contacted_by_SE, 'DD/MM/YYYY HH:mm')    //common feild in another fucntion
    var end = moment(data.Right_expert_found_at, 'DD/MM/YYYY HH:mm') //common feild in another function
    var new_value = end.diff(start, 'minutes');
    if (type == "edit") {
      console.log('edit');
      component.getRow().getCell("time_diff_FE_RE").setValue(new_value);
      return value;
    } else {
      return new_value
    }
  }

Rather I would explain this as mutator is not working on common feilds. Here is the fiddle explained with this above use case:



from Mutator in tabulator not working on same edited functions

No comments:

Post a Comment