Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

233
Views
How to delete many data in array if condition vue js

I have select many data and post to back end, it is succeed but after that i want to delete array data in front end without reload. I try with splice it is only delete one or two max is tow

Here is my code

const itemOrder = this.baskets.filter((el)=>{
    return el.checkbox == true
});

HTTP().post('/order',itemOrder).then(()=>{
});

after then i wont to delete all this baskets if checkbox is true

i have try

for(let i in this.baskets) {
    if(this.baskets[i].checkbox == true) {
        console.log(i);
        this.baskets.splice(i,1);
    }
}

and also try this

this.baskets.splice(this.baskets.findIndex(e => e.checkbox == true),1);

still does not work as my expectation

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You can filter all false checkboxes:

let baskets = [
  {id: 1, checkbox: true},
  {id: 2, checkbox: true},
  {id: 3, checkbox: false},
  {id: 4, checkbox: true},
  {id: 5, checkbox: true}
]

baskets = baskets.filter(b =>  b.checkbox === false)

console.log(baskets)

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!