I've a local indexeddb like this:
// Unlike localStorage, you can store non-strings.
localforage.setItem('123456', {
//0 - Ref cli
ref_cli: '4720271',
//1 - Offre client
offre_cli: 'Offre 3',
//2 - Date RDV
date_rdv: '22/09/2015',
//3 - Heure rdv
heure_rdv: '10H00',
//4 - Nom client
nom_cli: 'DURAND',
//5 - Prénom client
pren_cli: 'Pierre',
//6 -Adresse client
adr_cli: '3 rue de l\'église',
//7 - CP client
cp_cli: '75000',
//8 - Ville client
ville_cli: 'PARIS',
//9 - Batiment
bat_cli: 'A',
//10 - Escalier
esc_cli: '2',
//11 - Etage
etg_cli: '3'
}, function(err, value) { });
I want to update one item of this array. Eg:
offre_cli: 'offre 3' -> offre_cli: 'offre 4'
I've tried the code below, but it erases the previously array.:
localforage.setItem('123456', {offre_cli: 'offre 4'};
It's possible to update a single item, without update all array?
You can get the current object saved into localforage
, update it, and save it back. E.g:
localforage.getItem('123456').then(function (item) {
item.offre_cli = 'offre 4';
localforage.setItem('123456', item );
});
We find solution :). Thanks Buzinas for inspiration
localforage.getItem('123456').then(function ( item ){
item.offre_cli = 'offre 12';
localforage.setItem('123456', item);
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With