I have just created a very basic search for a site displaying the result in a repeater with a pagination bar. How do i set up the pagination bar to display only the pages holding results?
https://www.wix.com/corvid/reference/$w.Pagination.html
https://www.wix.com/corvid/forum/community-discussion/dynamic-paging-control
Can you share here your current code to better help you? Thanks
Thank you givemeawhisky and Robert for the quick response.
I have been using Wix for years but am only starting to use Corvid . The site I am building will be a repository for development reports and i will need to create a search that allows users to search the database using different parameters (keywords, categories, title…) It is very basic right now.
Below is the current code for my search and results pages.
Page with collection data display in repeater and search bar linking to results page
import wixData from “wix-data”;
import {local} from ‘wix-storage’;
import wixLocation from ‘wix-location’;
$w.onReady( function () {
});
export function searchButton_click(event) {
let word = $w(“#searchBar”).value;
local.setItem(“searchWord”, word);
wixLocation.to(/search
);
}
Result page (named search page)
// For full API documentation, including code examples, visit Velo API Reference - Wix.com
import {local} from ‘wix-storage’;
import wixData from ‘wix-data’;
$w.onReady( function () {
var sameWord = local.getItem(“searchWord”);
$w("#searchBar").value = sameWord;
$w("#searchBar").placeholder = sameWord;
$w('#dbreports').onReady( function () {
search();
});
});
export function searchButton_click() {
search();
}
function search() {
wixData.query('REPORTS')
.contains(‘title’, $w(“#searchBar”).value)
.or(wixData.query(‘REPORTS’).contains(‘abstract’, $w(“#searchBar”).value))
.or(wixData.query(‘REPORTS’).contains(‘author’, $w(“#searchBar”).value))
.or(wixData.query(‘REPORTS’).contains(‘textPreview’, $w(“#searchBar”).value))
.find()
.then(res => {
$w(‘#repResults’).data = res.items;
});
}
export function searchBar_keyPress(event) {
wixData.query(‘REPORTS’)
.contains(‘title’, $w(“#searchBar”).value)
.or(wixData.query(‘REPORTS’).contains(‘abstract’, $w(“#searchBar”).value))
.or(wixData.query(‘REPORTS’).contains(‘author’, $w(“#searchBar”).value))
.or(wixData.query(‘REPORTS’).contains(‘textPreview’, $w(“#searchBar”).value))
.find()
.then(res => {
$w(‘#repResults’).data = res.items;
});
//Add your code for this event here:
}