Update table in Dexie
Asked Answered
R

0

8

I try to update a field named "Type" in indexedDB with Dexie

    var db = new Dexie("Commande");

    db.version(1).stores({
    commande: "++id,idClient,nomClient,idInterne,statut,Type"
    }); 

    db.commande.where("id").equals(getId).modify({Type: "Multi"});

I try this also :

db.commande.where("id").equals(getId).modify(function(value) {
this.value = new commande({Type: "Multi"});
});

And also that :

db.commande.update(getId, {Type: "Multi"});

My field "Type" is never updated :(

Someone can help me about that ?

Image Table details

Repair answered 15/1, 2017 at 13:54 Comment(4)
Ok it is my fault.Repair
This work like a charm, sorry. dbc.commande.where("id").equals(getId).modify({Type: "Multi"});Repair
Did you ever figure out why db.table.update(id, changes) didn't work in your case? I am seeing the same now.Maxillary
For future Google travelers, I ended up using .put (its semantics were safe to use in my case), but I still have no idea why .update didn't work.Maxillary

© 2022 - 2024 — McMap. All rights reserved.