indexdb get by key

indexdb get by key

hi guys i try to retrive data using key and indexdb ... but with my code i show entire database not only record or colums of key... i study a lot but help  me to understand how retrive this value i attach a screenshot of db..! Regards

Here is code :

var dbRequest = indexedDB.open('newdbmed', 1);
dbRequest.onsuccess = function(event) {
   
  // works exactly the same way.
  var db = this.result;
var db = dbRequest.result;
  var db = event.target.result;
    
var transaction = db.transaction(['user'], 'readonly');
  var objectStore = transaction.objectStore('user');

  var myIndex = objectStore.index('nome'); 
  var getRequest = myIndex.get('bond');
  getRequest.onsuccess = function() {
    console.log(getRequest.result);
  }

  myIndex.openCursor().onsuccess = function(event) {
    var cursor = event.target.result;
    if(cursor) {
      
      alert(cursor.value.nome + cursor.value.cognome + cursor.value.farmaco + cursor.value.dosaggio + cursor.value.cf);
     

      cursor.continue();
    } 
      else {
      alert("Entries all displayed.");    
    }
  };
};
     }

regards..!

AttachmentSize
Downloadimage/png Cattura.PNG65.36 KB
2 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Daniele -- this is not a good forum for pure HTML5 questions, we are staffed to help you with the issues and problems associated with building and deploying Cordova apps on mobile devices. For questions related to how to use standard HTML5 features work you're better off searching the Stack Overflow and HTML5 Rocks web sites. For example, this search > https://www.google.com/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF... < might have some useful articles that will help you.

Leave a Comment

Please sign in to add a comment. Not a member? Join today