-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b7cdd1c
commit dbddba1
Showing
2 changed files
with
26 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,27 @@ | ||
document.addEventListener('DOMContentLoaded', async () => { | ||
// Initialize Dexie database | ||
const db = new Dexie("Team Tracking App"); | ||
db.version(1).stores({ | ||
teams: "++id, teamname, globalid" | ||
}); | ||
|
||
// Retrieve data from IndexedDB and fill the textbox if it exists | ||
const existingData = await db.teams.get(1); // Assuming you have only one record | ||
if (existingData && existingData.todo) { | ||
document.getElementById('teamname').value = existingData.teamname; | ||
} | ||
|
||
// Event listener for submit button | ||
document.getElementById('submitButton').addEventListener('click', async () => { | ||
const newData = document.getElementById('teamname').value; | ||
|
||
// Save or update data in IndexedDB | ||
if (existingData) { | ||
await db.teams.update(1, { teamname: newData }); | ||
} else { | ||
await db.teams.add({ teamname: newData }); | ||
} | ||
|
||
alert('Data saved successfully!'); | ||
}); | ||
}); | ||
// Initialize Dexie database | ||
const db = new Dexie("Team Tracking App"); | ||
db.version(1).stores({ | ||
teams: "++id, teamname, globalid" | ||
}); | ||
// Retrieve data from IndexedDB and fill the textbox if it exists | ||
const existingData = await db.teams.get(1); // Assuming you have only one record | ||
if (existingData && existingData.todo) { | ||
document.getElementById('teamname').value = existingData.teamname; | ||
} | ||
// Event listener for submit button | ||
document.getElementById('submitButton').addEventListener('click', async () => { | ||
const newData = document.getElementById('teamname').value; | ||
// Save or update data in IndexedDB | ||
if (existingData) { | ||
await db.teams.update(1, { teamname: newData }); | ||
} else { | ||
await db.teams.add({ teamname: newData }); | ||
} | ||
alert('Data saved successfully!'); | ||
}); | ||
}); |