Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

74
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda