Skip to content

GetByIndex returning Undefined #72

Description

@Maverik005

Here is my openDatabase

openDatabase(tableName: string,tableColumns: string[], indexedDBObj: AngularIndexedDB){ //Create DB Version 1 indexedDBObj.openDatabase(indexedDBObj.dbWrapper.dbVersion, (evt) => { let objectStore = evt.currentTarget.result.createObjectStore(tableName, { keyPath: "Id", autoIncrement: true }); tableColumns.forEach(col => { objectStore.createIndex(col, col, { unique: false }); }); }) }

Keypath:"Id" and I am creating index on every property of the object

Then I am trying to getByIndex like this:

indexedDBSelectByIndex(tableName:string, indexName:string, key:string,indexedDBObj: AngularIndexedDB ){ return indexedDBObj.getByIndex(tableName, indexName, key); }
I am passing indexName as "UsedInRuleItemId",key as the value of the index, and storeName is tableName. It still retuning me undefined value. Ideally it should return the object that contains the value of the index I am passing to it.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions