Am getting the error of firebase.database is not a function when tryna use update syntax using javascript. here are my 2 files
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 35/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Estancado
- Stack tecnológico
- javascript
- Área
- database
Línea de trabajo
Empieza leyendo el script de módulo inline del HTML proporcionado y js2.js, y después reproduce el error de firebase.database con el flujo de actualización mostrado. Compara las importaciones de Firebase y la inicialización con el punto de entrada de actualización; se considera terminado cuando el registro de UsersList se actualiza sin el TypeError indicado.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
<style>
.labs{
display: inline-block;
width: 100px;
}
</style>
</head>
NFC MTC GRAB CUSTOMERS
<div class="container mt-3">
<div class="input-group mb-3">
<input id="SearchBar" type="text" class="form-control" placeholder="Search using the" aria-label="Recipient's username" aria-describedby="button-addon2">
<div class="input-group-append">
<select class="custom-select" id="CategorySelected">
<option selected value="1">name</option>
<option value="2">username</option>
<option value="3"> email</option>
<option value="4"> password</option>
</select>
<button id="SearchBtn" class="ml-1 btn btn-outline-info" type="button" id="button-addon2">SEARCH</button>
</div>
</div>
Back
Add User
Add driver
Driver's list
</thead>
<tbody id="tbody1">
</div>
Control Pannel
× Full name:Username:
Email:
Password:
<div class="modal-footer">
<button id="AddModBtn" type="button" class="btn btn-info" onclick="Addstd()">Add</button>
<button id="UpdModBtn" type="button" class="btn btn-success" onclick="Updstd()">Update</button>
<button id="DelModBtn" type="button" class="btn btn-danger" onclick="Delstd()">Delete</button>
</div>
</div>
</div>
| Sno | Full Name | Username | password | Control Center |
|---|
<script type="module">
function AddItemToTable(fullname,username,email,password) {
var tbody = document.getElementById("tbody1");
let tr = document.createElement("tr");
let td0 = document.createElement("td");
let td1 = document.createElement("td");
let td2 = document.createElement("td");
let td3 = document.createElement("td");
let td4 = document.createElement("td");
stdList.push([fullname,username,email,password]);
td0.innerHTML = ++stdNo;
td1.innerHTML = fullname;
td2.innerHTML = username;
td3.innerHTML = email;
td4.innerHTML = password;
td1 .classList +="nameField";
td2.classList +="dateField";
td3.classList +="timeField";
td4.classList +="phoneField";
tr.appendChild(td0);
tr.appendChild(td1);
tr.appendChild(td2);
tr.appendChild(td3);
tr.appendChild(td4);
var ControlDiv = document.createElement("div");
ControlDiv.innerHTML = '<button type="button" class="btn btn-info" my-2 ml-2" data-toggle="modal" data-target="#exampleModalCenter" onclick = "FillTboxes('+stdNo+')"> Edit </button>';
ControlDiv.innerHTML += '<button type="button" class="btn btn-info" my-2 ml-2" data-toggle="modal" data-target="#exampleModalCenter" onclick = "FillTboxes(null)"> Add </button>';
tr.appendChild(ControlDiv);
tbody.appendChild(tr);
}
function AddAllItemsToTable(TheStudent) {
stdNo = 0;
tbody.innerHTML = "";
TheStudent.forEach(element => {
AddItemToTable(element.fullname, element.username, element.email,element.password );
});
}
//............................................gettign data........................//
import { initializeApp } from "https://www.gstatic.com/firebasejs/9.8.3/firebase-app.js";
import { getAnalytics } from "https://www.gstatic.com/firebasejs/9.8.3/firebase-analytics.js";
const firebaseConfig = {
apiKey: #######
authDomain: #############
databaseURL: ############
projectId: #########
storageBucket: ###########
messagingSenderId: #########
appId: ########
measurementId: #########
};
// Initialize Firebase
const app = initializeApp(firebaseConfig);
var stdNo;
import {getDatabase, ref , child, onValue, get}
from "https://www.gstatic.com/firebasejs/9.8.3/firebase-database.js";
const db = getDatabase();
function GetAllDataOnce(){
document.getElementById("tbody1").innerHTML="";
stdNo = 0;
const dbref = ref(db);
get(child(dbref, "UsersList"))
.then((snapshot)=>{
var students =[];
snapshot.forEach(childSnapshot =>{
students.push(childSnapshot.val());
});
AddAllItemsToTable(students);
});
}
window.onload = GetAllDataOnce;
var searchBar = document.getElementById("SearchBar");
var searchBtn = document.getElementById("SearchBtn");
var category = document.getElementById("CategorySelected");
var tbody = document.getElementById("tbody1");
function SearchTable(Category){
var filter = searchBar.value.toUpperCase();
var tr = tbody.getElementsByTagName("tr");
var found;
for (let i = 0; i < tr.length; i++) {
var td = tr[i].getElementsByClassName(Category);
for ( let j = 0; j < td.length; j++) {
if(td[j].innerHTML.toUpperCase().indexOf(filter) > -1){
found=true;
}
}
if(found){
tr[i].style.display="";
found=false;
}
else{
tr[i].style.display="none";
}
}
}
searchBtn.onclick = function(){
if(searchBar.value==""){
SearchTable("nameField");
}
else if(category.value==1)
SearchTable("nameField");
else if(category.value==2)
SearchTable("dateField");
else if(category.value==3)
SearchTable("timeField");
else if(category.value==4)
SearchTable("phoneField");
};
</script>
<script src="js2.js"></script>
var firebase= {
apiKey: ########
authDomain: ###########
databaseURL: #############
projectId: ########
storageBucket: ##########
messagingSenderId:#########
appId: ############
measurementId: ###########
};
var stdNo = 0;
var stdList =[];
var ModName = document.getElementById('NameMod');
var ModRoll = document.getElementById('RollMod');
var ModSec = document.getElementById('SecMod');
var ModPass = document.getElementById('PassMod');
var BTNmodAdd = document.getElementById('AddModBtn');
var BTNmodUpd = document.getElementById('UpdModBtn');
var BTNmodDel = document.getElementById('DelModBtn');
function FillTboxes (index){
if(index==null){
ModName.value = "";
ModRoll.value = "";
ModSec.value = "";
ModPass.value = "";
BTNmodAdd.style.display='inline-block';
BTNmodUpd.style.display='none';
BTNmodDel.style.display='none';
}else{
--index;
ModName.value = stdList[index][0];
ModRoll.value = stdList[index][1];
ModSec.value = stdList[index][2];
ModPass.value = stdList[index][3];
ModPass.disabled = true;
BTNmodAdd.style.display='none';
BTNmodUpd.style.display='inline-block';
BTNmodDel.style.display='inline-block';
}
}
function Updstd(){
firebase.database().ref('UsersList/'+ModRoll.value).update(
{
fullname: ModName.value,
username: ModRoll.value,
email : ModSec.value,
password : ModPass.value
},
(error) =>{
if(error){
alert("failed to update the records");
}else{
alert("success updated");
GetAllDataOnce();
$("exampleModalCenter").modal('hide');
}
}
)
}
function Delstd(){
firebase.database().ref('UsersList/'+ModRoll.value).remove()
alert("deleted successfully");
GetAllDataOnce();
$("exampleModalCenter").modal('hide');
};
- Lenguaje dominante
- JavaScript
- Estrellas
- 1.9k
- Forks
- 1.8k
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de firebase/codelab-friendlychat-web
-
Codelab freindly chat website.Abierto
Dificultad 5/5 Más de una semana Aptitud para principiantes 15/100
-
RunAbiertobug
Dificultad 5/5 Más de una semana Aptitud para principiantes 10/100
firebase/codelab-friendlychat-web#877 · 2 comentarios ·
-
Go to '...'Abiertobug
Dificultad 5/5 Más de una semana Aptitud para principiantes 10/100
-
CameraAbierto
Dificultad 5/5 Más de una semana Aptitud para principiantes 20/100
-
Sifsin projectAbiertobug
Dificultad 5/5 Más de una semana Aptitud para principiantes 10/100
firebase/codelab-friendlychat-web#837 · 1 reacción ·
Todos los issues de firebase/codelab-friendlychat-web
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 73/100
soroswap/token-list#125 ·
Los mantenedores suelen responder en 1 día
-
marketing
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día
-
bug help wanted
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
Fei2411/DeepSeek-Bot#1824 ·
-
bug pydanty:is-working
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
pydantic/pydantic-ai#13939 ·
Los mantenedores suelen responder en 1 día