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

164
Visualizações
No Link when null value (Using labels) - Tabulator

I'm using Tabulator 5.1 and it's been great so far. However I have a question that I hope is a quick answer.

I'm loading my data via AJAX, but I have a link column that I need help with. The link formatter works great and I set the "label" property so I can have them all uniform. However, I found that some of my rows coming into the table don't have a URL and when you use the label property it creates it for every row regardless of if there is a URL for it to make a link or not.

So my issue is that I have a column with links and some will send the user to the URL and others are "undefined" (null value from the AJAX call) and so they present an error page.

My question (finally) is, is there a way to blank out the rows that have a Null value while still being able to use the "label" property?

If I remove the "label" property the rows that don't have a URL blank out as expected, it's only when I try to use a label do I run into this issue.

EDIT: So I looked around some more and found a couple of things on the formatter. I see you can use a function to get the label however I can't see to get the logic working right. Here's what I've got so far that I'm trying to play around with:

label: function(cell){
          if (cell.getData().title == "null"){
            return ""
          } else {
            return "Click Here"
          }
        },

However that still only seems to get "Click Here" for every row.

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

0

Looks like I found outdated information. This is the code I used to get a custom label while still being able to leave the rows with blank URLs as a blank cell:

formatterParams: {
        label: function(cell){
          if(cell.getValue() == null){
            return ""
          } else {
            return "Click Here"
          }
        },
        target: "_blank"
      },

That's my entire formatterParams value in case anyone needs it. I swore I had tried getValue() before, but this time it worked. Hopefully this helps someone in the future if they need this same thing.

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