I have a repeater that is connected to a database via the dataset. I would like to sort the items within the repeater by their numerical value. However, the items I would like to sort that contain the numerical value are not connected to the database. This is because the numerical value that needs to be sorted depends on input values from the user. Does anyone have the code needed to accomplish this task? I have researched the issue on the Forum and did not locate a solution. If possible, would you please “dummy” it down for me as I have only been coding for three months.
Short example-excerpt…
wixData . query ( COLLECTION )
. contains ( DATAFIELD , VALUE)
. descending (VALUE). find (). then ( res => { });…
- You get some → RESULTS (results.items)
- You feed a REPEATER with this results…
$w(REPEATER).data=results.items
- You load data when repeater is ready…
$w(REPEATER).onItemReady(($item, itemData, index)=>{
$item("#elementID").xxxxxxx = "xxxxxxx" // whatever here......
});
Thank you very much for the response. I’ll give it a try…
Sorry some little mistake from my side…
. descending ( VALUE ). find (). then ( res => { });…
instead it should be…
. descending ( DATAFIELD ). find (). then ( res => { });…
some example can be found here…
https://www.wix.com/velo/reference/wix-data/wixdataquery/ascending
Thank you; I’ll try this out…