Pass URL String to Create Dynamic Table on Dynamic Page


I work for an organization that offers three different buildings on its campus, each with 2-3 spaces within it, that can be rented alone, or in combination with the others. When someone clicks on the repeater for Building 1, I’d like them to go to a dynamic page with a dynamic table that shows the price for it, as well as the prices for its rooms, each in combination with the other two Buildings and their rooms. For each combination, the prices vary depending on the day of the week.

My collection is called “Rentals.” The rows are the buildings, rooms, and their various combinations. The columns are Mon-Wed and Thu.

I’ve placed a repeater on a page called “Rent” that links to 3 dynamic pages, one page for each Building. I’d like the dynamic page to display table results from my collection based on the URL. Below is my code. Right now, the table doesn’t display any results, even though my collection has multiple entries that contain the building name. Any suggestions? Thank you in advance.

import wixLocation from ‘wix-location’ ;
let url = wixLocation.url;
import wixData from “wix-data” ;

$w.onReady( function () {
wixData.query( “Rentals” )
.contains( “title” , “url” )
.find() // Run the query
.then(res => {
// Set the table data to be the results of the query
$w( “#weddingtable” ).rows = res.items;

$w.onReady( function () {
$w( “#weddingtable” ).columns = [{
“id” : “col1” ,
“dataPath” : “title” ,
“label” : “Space” ,
“type” : “string” ,
}, {
“id” : “col2” ,
“dataPath” : “weddingPriceMW” ,
“label” : “Wedding Price M-W” ,
“type” : “string” ,
}, {
“id” : “col3” ,
“dataPath” : “weddingPriceThu” ,
“label” : “Wedding Price Thu” ,
“type” : “string” ,

  1. Use only one $w.onReady() for the whole page and set the table columns at the beginning.

  2. Your query is wrong. You’re searching for a title that is equal to the word “url”. Instead of the variable url.