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

113
Visualizações
Google Sheets - Insert via json

I am using the tool sheety ( https://sheety.co/ ) to put information into Google Sheets.

Unfortunately, I'm not very savvy with json and have pieced this together as much as I could.

The problem is that when the function is triggered, other columns are also changed. Does anyone have a solution why this is so and how I can prevent this?

I would be happy if someone could help me. If you have any questions, please do not hesitate to contact me.

var products = null;

// Called once the page has loaded
document.addEventListener('DOMContentLoaded', function(event) {
    loadItems();
});

var projectUrl = 'XXX';

function loadItems() {
    fetch(projectUrl + '/products')
    .then((response) => response.json())
    .then(json => {
        this.products = json.products.sort((a, b) => {
            return a.erledigt < b.erledigt;
             console.log(json.products);
        })
        showAllItems();
         console.log(json.products);
    });
}

function drawItems(products) {
    var template = Handlebars.compile(document.getElementById("products-template").innerHTML);
    document.getElementById('products-container').innerHTML = template({
        products: products  
    });
}


function showAllItems() {
    drawItems(this.products);
}

function upvoteItems(id) {
    let product = this.products.find(product => {
        return product.id == id;
    });
    product.done = 1;
    
    let headers = new Headers();
    headers.set('content-type', 'application/json');
    fetch(projectUrl + '/products/' + id, {
        method: 'PUT',
        body: JSON.stringify({ product: product }),
        headers: headers
    });
    
    showAllItems();
}
about 4 years ago · Juan Pablo Isaza
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