javascript - Lawnchair json store removing records -


i using lawnchair in app creating in cordova. having erattic problems when removing records ie, code remove first record second removed or uncaught typeerror: cannot set property 'key' of undefined. has had problem or doing wrong. if run script below , try remove records in different sequences problem manifest. appreciated. thanks.

<!doctype html><html> <head> <title>lawnchair</title> <script type="text/javascript" src="js/lawnchair-0.6.1.js"></script> </head> <body> <script type="text/javascript">  var tmpstore1 = new array(); tmpstore1.push({ "isbn":9781565926998,                  "title":"jquery",                  "book":"pdf",                 "qty":3,                 "value":12.46               } );  var tmpstore2 = new array(); tmpstore2.push({ "isbn":123456789,                  "title":"lawnchair",                  "book":"web",                 "qty":6,                 "value":5.67               } );  var tmpstore3 = new array(); tmpstore3.push({ "isbn":987654321,                  "title":"extjs",                  "book":"web",                 "qty":1,                 "value":8.45               } );  var viewdata = lawnchair( function(e){ //open store     console.log('store ready '); }); //    viewdata.nuke();  viewdata.save({key:9781565926998, data:tmpstore1}); // save 1 viewdata.save({key:123456789, data:tmpstore2}); // save 2 viewdata.save({key:987654321, data:tmpstore3}); // save 3 // hash out remove records individually  isbn = 9781565926998; viewdata.remove(isbn); //delete 1 isbn = 123456789 viewdata.remove(isbn); //delete 2 isbn = 987654321 viewdata.remove(isbn); //delete 3  viewdata.each(function(record) {     console.log(record.data[0].isbn+' - '+record.data[0].title);     console.log(record); }); </script> </body> 

to make work isbn should string, ie: isbn = "9781565926998" or object key value set isbn value. give try.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -