Webget firebase and list picker elements

Hello my friends.
I got a little stuck in here, and I need your advice.

I use web component to retreive a list from firebase, and update a listview.
I need when a user pick an item to be deleted (even if created by other user).

Here is some img for better understanding.

So, if I put the correct UID in webGetVolts in a textBox is working but how to put it automatically and hide it from listview?

Thank you very much for any support!

Or there is another way?

Hello,

you have a guide here to add/update/delete/get items from firebase with Web component.
METRIC RAT AI2 - Firebase Demo: No Security with Web Component

Remember, once you have removed the item from firebase, to remove the same item from your "volts" list.

Relative to the ListView, if you want to show in list view only some items from the original list, you can create a second list only with those items to show. For example, if I don't want to show the last one I can create a new list without the last element of each item:

Thank you Ramon,
I read that article, very good indeed but there is no solution for my situation.
I have the firebase like this:
Untitled - 2

with my code if I put my UID (where question mark is) will delete all x_orders, but I need only to delete the UID that I selected from list including volt,amp,date and active.

I need somehow to compare the UID that clicked in list and to complete the delete action. because any user can delete any UID and all it's data

or to make a separate list of UID and compare the one selected in listpick and with a confirmation dialog to insert it in "delete function"????

I disagree. Here are the example blocks for deleting a firebase tag and its contents:

In your case you want to replace myData1 with your UID value.

As @Ramon has suggested use a partial list to display your listview, and the selectionIndex of that listview to select the UID value from your original list.

but Tima, If I put my UID will not delete other UID, right?
Thank you I will still trying!

Well, If I make a list with UID's and a list with all data (volt, amp,date), when listPicker populate with volt, amp,date how can I extract the coresponding UID?

Then use Web component to delete that UID.

https://<URL>/<ProjectBucket>/x_orders/<UID>.json

will delete the data:

image

if you use the UID shown (BKsakbgjH....)

yes, but any user with any UID can delete other user UID when picking from list.

I need somehow to compare when

  • item is selected from list
  • it corespond to following UID

and add that selected UID in the delete function

where is the UID to compare with?

That I dont know...
I mean when I select from list "volt" I need somehow to know the parent UID...

I made a separate list with UID like:

Screenshot 2024-05-10 120447

or any easyer solution?

I have shown you in the above example....use the SelectionIndex of the ListView to get the corresponding UID:

So, when I click button1 the list picker will populate vith volt's from different UID.
How can I put in label1 the parent UID of selected "volt"?

Thank you!

Look at the examples

Yes, but I dont think firebase can keep indexes in place. Or I am mistaken?

Well. We have several things here and I guess you're mixing all of them:

  1. Show the info into the listView without the UID. For this you need to make an aux list without that item and then display it in ListView.

  2. When an item is selected from ListView be able to get its UID. This you can do it with the examples I showed you.

  3. Remove the UID (and its data) from firebase. With the UID get in the step 2, do what @TIMAI2 has indicated.

  4. Remove the same item from the list you are using in ListView (and from the original list), and refresh ListView so that the listView shows the list without the recently deleted element.

Thank you so much , I think I get it working

Might just be easier to set some secure rules on your firebase, read all , write only.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.