0
I’m trying to take values from a line and pass to the key in the normal array created for inserted values I can pick up but then I went through keys of the database and data of the firebase of a root and the values I played inside another array I call filter but ai k the values pass to the list but I can’t get the values this way you can help me ?
/ Starting the filter
var filter = []; // Filter 1
// var filter = new Array(); // Filter 2
var allData = snap.child("/").val();
filter.push(allData); // getting all values from the root 'CPSHOW'
/* filter.map((va) => { // Traversing filter data
}) */ // Line of filter Looping -----
filter.foreach(element => {
// Settup choice filter values or keys
// var k = Object.keys(va); // Get the keys only
// var v = Object.values(va); //
// Passing keys to filter 2
// var filterKeys = [v];
// filterKeys.push(k); // Arrays
//console.log(element);
/* ----- Designing the Listview and Binding ----- */
var designListview = document.getElementById("layout-list");
designListview.innerHTML +=
`
onclick = "s()">+element.Title+
<img src = "+element.Image+
"
key = "+element.Image+
" href = "#" class = "image" id = "image"
width = "100px"; height = "100px";
style = "box-shadow: 5px 5px 5px; Boder: 3px;" />
/* ----------------------------- */
/* ----- On Binding Listview ----- */
// =>
/* ---Binding Listview--- */
var onClickingList = document.getElementsByTagName("img");
for(var x = 0; x < onClickingList.length; x++) {
onClickingList[x].addEventListener('click', function(key){
// key = this.getattribute('key'); key = Document.getElementById("key"); filter[key];
upDateList();
return false;
});
}
upDateList = (key) => {
// console.log(items);
console.log(key);
}
// console.log(element);
}); // Foreach Looping...
}); // Line of database -----
} // Line of database -----
onChildAdded(); // Initialising to get database data values and Keys...
// Testing to get value s = (g) => { var valueOf = getelementsbytagname('price'); for(var l = 0; l < valueOf.length; l++) g = this.getattribute('price'); filter[l]. Price++; console.log(valueOf) ;
} // Testing
// *****-----End of line-----****** //
// Comments Bellow.....
// Create filter or array "Study"
/* var filter = [];
var allData = snap.child("/").val();
filter.push(allData); // All data with keys
filter.map((va) => { // Percorrendo os dados do filtro
// Settup choice filter
var v = Object.keys(va); // Get the keys only
// Passing keys to filter
var filterKeys = [];
filterKeys.push(v); // Arrays
// console.log(va);
}) */
/* const img = document.createElement('img');
img.src = image;
img.width = 100;
img.height = 100;
img.marging = 15;
document.querySelector('.img-list').appendChild(img);
*/
-------- Abixus work ------
the top no ---------
items.map((va) => {
document.getElementById('div-1').innerHTML += `<div style = " background-color: #212121; cursor: pointer;
text-align: center;
box-shadow: 5px 5px 5px;">
<div style = " background-color: #309847;
width: 150px;
height: 50px; box-shadow: 5px 5px 5px; border: 3px; text-align: center; color: #ffffff; font-size: 30px; "
> <p> `+va.name+` </p> </div>
<img src = "`+va.photo+`" key = "`+va.quantity+`" href = "#" class = "img"
width = "100px"; height = "100px"; style = " box-shadow: 5px 5px 5px; boder: 3px;" />
<p style = "left: 100px;
top: 0px;
color: #ffffff; font-size: 25px;"> <strong> `+va.quantity+` </strong></p>
</div>`;
})
/* ---Binding Listview--- */
upDateList = () => { console.log(items);
}
var onBindingListview = Document.getelementsbytagname("img"); for(var x = 0; x < onBindingListview.length; x++) {
onBindingListview[x]. addeventlistener('click', Function(){
Let key = this.getattribute('key'); items[key]. Quantity++;
upDateList();
Return false; });
}