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

79
Visualizações
Update the data from spliced array of object

So, I have splice the data and I want to update it's object from disabled = true to disabled = false .. I have looking for another answer and cant find one..

Any Advice is appreciated. Thank you

this is my dropdown

const newDrop = [
  { key: "1", label: "Monthly GMV", sublabel: "Max.1" },
  { key: "2", label: "AOV", sublabel: "Max.1" },
  { key: "3", label: "Monthly Order", sublabel: "Max.1" },
  { key: "4", label: "Last Purchase", sublabel: "Max.1" },
  { key: "5", label: "Has Purchase" },
  { key: "6", label: "Has Purchase Spesific Product" },
  { key: "7", label: "Located In", sublabel: "Max.1" },
];

selected function : when selected the dropdown, it will add new attribute disabled:true

newInput({ key }) {
    const {
      changeFormAttribute,
      form: { selectedDrop, newDrop, data },
    } = this.props;

    itemIndex = newDrop.map((itm) => {
      let x = itm.key === key;

      return x && itm.key !== "6" && itm.key !== "5" ? { ...itm, disabled: true } : { ...itm };
    });
    
    changeFormAttribute({
      newDrop: itemIndex,
    });
  }

delete function: this is onClick function, when clicked, it should splice the data, and check, if the spliced data have disabled === true change it to disabled:false . the spliced have working properly, but not change the attribute to disabled = false

 deleteInput(index) {
    const {
      changeFormAttribute,
      form: { selectedDrop },
    } = this.props;
  
    let selected = selectedDrop || [];
    selected.splice(index, 1).map((e) => {return e.disabled === true ? false:true })

    changeFormAttribute({ selectedDrop: selected });
  }
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Your splice function not returning the element. You may need to change it to


 selected.splice(index, 1).map((e) => {
     e.disabled === true ? false:true
     return e; 
 })
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