I need to sort the data in the listview by prioritet

for_forum
I want to get in list according to the details prioritet
for_forum2

2


4

It is messy trying to do this with blocks and the firebase experimental component.

You should use indexing in your rules in Firebase and get Firebase to do all of the hard work by then sending a query.

You will need to use the web component for this.

Firebase with a Web Component

Firebase | Retrieving Data

data


rules

HELP me please

rules2

I think your rules should be something like this:

{
  "rules": {
      "Voda": {
         ".read": true,
         ".write": true,
         ".indexOn": [".value","Prioritet"]
       }
   }
}

And in the URL: ....?orderBy="Prioritet"


and where is my data? The whole page is here

Maybe you URL is not well formed...It would be something like this:

https://<your_firebase_link>/Voda.json?orderBy="Prioritet"

zapr


and without a dot it gives out
error Permission,denied

with the dot is not correct. Which rules have you configured?

{
"rules": {
"voda": {
".read": true,
".write": true,
".indexOn": [".value","Prioritet"]
}
}
}

you can see that voda is not the same than Voda.

{
  "rules": {
      "Voda": {
         ".read": true,
         ".write": true,
         ".indexOn": [".value","Prioritet"]
       }
   }
}

Thanks a lot, everything is working

however, the data on Prioritet is not sorted why?

from Firebase:

"The filtered results are returned unordered. If the order of your data is important you should sort the results in your application after they are returned from Firebase."

1 Like

You can use the sortBy field to filter the data received in the response, but to order them you need to sort in the app.
Thank you @TIMAI2

You could always run a different query to return all the Prioritet values that equal 1, or 2 etc.

and how to do it

that is, you need to repeat the request

thanks, I will try