Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

253
Visualizações
Tabulator: formatter:"link" prevents mutator from running

fairly new to using tabulator but really love it for what I've seen so far. Unfortunately I´m stuck with the following problem: I want to calculate the sum of some of the cells in every row. Achieved this via using a mutator. Furthermore the mutator is also fired after the user edits a cell by the use of cellEdited with a function using row.update(). Everything is working fine until I add a formatter:"link" to one of the columns. Somehow the link-generation prevents the mutator from working. I think this has to do with the sequence of callbacks, but since I still know a little about tabulator and js thats just a guess.

Here is my (shortened) table-generator:

var table
var tabledata = table_data
var choices = [0, 1, 2, 3]
var getUrl = function(cell){
             var url_id = cell.getRow().getCell('id').getValue();
             return "/xyz/" + url_id
           }
var customMutatorSumCur = function(value, data, type, params, component){
        return data.knowledge + data.commitment;
    }
table = new Tabulator(
      "#ratings-table",
      {
        selectable:false,
        layout:"fitDataTable",
        data:tabledata,
        columns:[
          {title:"id", field:"id", visible:false},
          {title:"Name", field:"name", formatter:"link", formatterParams:{
             labelField:"name",
             url:getUrl,
          }},
          {title:"Knowledge", field:"knowledge", editor:"select", editorParams:
{values:choices}, cellEdited:function(cell){
cell.getRow().update({points_cur:true})}},
         {title:"Commitment", field:"commitment", editor:"select", editorParams:{values:choices}, cellEdited:function(cell){
cell.getRow().update({points_cur:true})},
         {title:"Points", field:"points_cur", mutator:customMutatorSumCur},
        ],
    );

The generated link is working fine, the value in the field "Points" is correct in the beginning, but its not updated on cell editing. If I omit this part:

, formatter:"link", formatterParams:{
           labelField:"name",
           url:getUrl,

the "Points" value is updated correctly after every cell-edit, but of course I no longer have a link. Maybe someone can point me in the right direction to where I made a mistake and can help me find a solution...

best regards, roman

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

A formatter will never prevent a mutator from running, they are completely separate systems, and the formatter is called any time a value in that cell has been updated.

The issue you are having is that the mutator is only called on a column when its value is updated, in this case your mutated column is getting its value from two other columns, so while those columns are updated the mutated value isnt because the mutator is not called again.

I would suggest calling the update function on the row in the cellEdited function on the name and knowledge columns, this will retrigger the mutator:

cell.getRow().update({"points_cur":true})

Also on a separate note, this line is a bit unnecessary, you do not need to retrieve the cell to get the data:

cell.getRow().getCell('id').getValue();

it should be:

cell.getData().id;
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda