Posts

Showing posts with the label pagination

Firebase pagination not working when fetching posts from different users

Image
Clash Royale CLAN TAG #URR8PPP Firebase pagination not working when fetching posts from different users I am trying to paginate data from firebase with a query based on "creationDate" and my code works when I am not following anyone, but as soon as I follow someone with a different uid, the main feed begins to duplicate posts and not order them correctly. Here's what a snapshot of the data I am fetching looks like: The snapshot key is the key of the post that is later fetched and the child of this snapshot holds references to the poster's UID, as well as the creationDate of the post, which is used to order the query. The code for fetching the data is below: static func loadPosts(posts: [Postt], isFinishedPaging: Bool, completion: @escaping ([Postt], Bool) -> Void) { guard let uid = Auth.auth().currentUser?.uid else {return} var pagingTemp = isFinishedPaging let ref = Database.database().reference().child("feed").child(uid) var query = ref...

How do I implement search to happen across pages without making a call to the DB in MVC?

Image
Clash Royale CLAN TAG #URR8PPP How do I implement search to happen across pages without making a call to the DB in MVC? I have a search function that works fine,, but only for the first page. I have implemented the pagination concept in my application. Here's my search function: function Search() { var se = $('#SearchGrid').val().toUpperCase(); var i, td; debugger; var x = document.getElementById("VolunteerGrid"); var tr = x.getElementsByTagName("tr"); for (i = 0; i < tr.length; i++) { td = tr[i].getElementsByTagName("td")[0]; if (td) { if (td.innerHTML.toUpperCase().indexOf(se) > -1) { tr[i].style.display = ""; } else { tr[i].style.display = "none"; } } } } I want this search function to get all the rows and not just the rows on the first page and show the result. Here's my simple view: ...