IndexedDB delete record not working

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gowthamavel
    New Member
    • Apr 2013
    • 3

    IndexedDB delete record not working

    i just got the code from the following link

    Getting Started with IndexedDB

    While running the delete function it doesn't throw an error..but still delete Function didn't work


    Code:
    btnDelete.addEventListener("click", function () {
    var id = document.getElementById('txtID');
    var transaction = db.transaction(['people'], 'readwrite');
    var objectStore = transaction.objectStore('people');
    var request = objectStore.delete(id);
    request.onsuccess = function (evt) {
    };             
    });

    while the remaining functions ADD,PRINT works,
    Also updates in the IDB, but DELETE doesn't work
    For reference check the url mentioned above..

    Please figure it out,
    Thanks in advance
  • vijay6
    New Member
    • Mar 2010
    • 158

    #2
    Hey gowthamavel, is you trying to delete 'textbox' or 'textbox value' in your IndexedDB? (Check line number 2 in your code)

    Comment

    • gowthamavel
      New Member
      • Apr 2013
      • 3

      #3
      I have changed the code as follows but still it didn't work

      Code:
      var id = document.getElementById('txtID').value;

      Comment

      • vijay6
        New Member
        • Mar 2010
        • 158

        #4
        Hey gowthamavel, use explicit casting (convert textbox value from string to int).

        Comment

        • gowthamavel
          New Member
          • Apr 2013
          • 3

          #5
          Thanks a lot!!
          Its working!!

          Comment

          Working...