IDBIndex: isAutoLocale property
Deprecated: This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes. Avoid using it, and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.
Non-standard: This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future.
The isAutoLocale
read-only property of the IDBIndex
interface returns a boolean value indicating whether the index had a locale
value of auto
specified upon its creation (see the options
parameter to IDBObjectStore.createIndex()
.)
Value
A boolean value.
Examples
In the following example we open a transaction and an object store, then get the index lName
from a simple contacts database. We then open a basic cursor on the index using IDBIndex.openCursor
— this works the same as opening a cursor directly on an ObjectStore
using IDBObjectStore.openCursor
except that the returned records are sorted based on the index, not the primary key.
The isAutoLocale
value is logged to the console.
function displayDataByIndex() {
tableEntry.textContent = "";
const transaction = db.transaction(["contactsList"], "readonly");
const objectStore = transaction.objectStore("contactsList");
const myIndex = objectStore.index("lName");
console.log(myIndex.isAutoLocale);
myIndex.openCursor().onsuccess = (event) => {
const cursor = event.target.result;
if (cursor) {
const tableRow = document.createElement("tr");
for (const cell of [
cursor.value.id,
cursor.value.lName,
cursor.value.fName,
cursor.value.jTitle,
cursor.value.company,
cursor.value.eMail,
cursor.value.phone,
cursor.value.age,
]) {
const tableCell = document.createElement("td");
tableCell.textContent = cell;
tableRow.appendChild(tableCell);
}
tableEntry.appendChild(tableRow);
cursor.continue();
} else {
console.log("Entries all displayed.");
}
};
}
Specifications
Not currently part of any specification.
Browser compatibility
BCD tables only load in the browser
See also
- Using IndexedDB
- Starting transactions:
IDBDatabase
- Using transactions:
IDBTransaction
- Setting a range of keys:
IDBKeyRange
- Retrieving and making changes to your data:
IDBObjectStore
- Using cursors:
IDBCursor
- Reference example: To-do Notifications (View the example live).