Hi,
Ive got a couple of map questions.
I have build a defibrillator database and with the maps I want to be able to show all the defibs (not just 100) and only show the details of the one selected , rather than a list.
We are on a small island so the searching function is of no use. People want to scroll.
Any thoughts would be appreciated.
I had a similar issue creating an endless scroll of photos sourced from a Knack table. The answer may be in a recursive API requery/query : It’s amazing what you can acheive using javascript and Knack - take a look at Photo Gallery — Isoblue Projects & Development Site the grid of photos is stored in knack as a list, if you reload the grid, you’ll see it’s randomised. It’s also bubble sorted so photos tagged pro come at the top, followed by flagged, followed by remainder. The results are then displayed using fanscybox.js.
You could use the API but there is a security risk in revealing your app key etc in the script. however this can still be done using the view.
For example,
// Function to load all records and render them
function loadAndRenderRecords(viewId, sortType) {
// Use infinite scroll or a button click to load more records
Knack.views[viewId].model.fetch({
success: function(model, response) {
// Once all records are loaded, render the prioritized grid
renderPrioritizedGrid(viewId, sortType);
},
error: function(model, response) {
console.error(“Error loading records from view.”);
}
});
}
// Initialize Fancybox and fetch records once the script is loaded
script.onload = function() {
console.log(“Fancybox 4 has loaded”);
// Load and render records from view_xxx (no need for API key)
loadAndRenderRecords('view_xxx', 1); // Set sortType to your preferred value (1 = random, 2 = most recent, 3 = earliest)
};
I hope that at leasts sets you on a path to a solution.
Good luck. Chris.
NB. To save you time, please note whilst I need this myself, I have yet to test this in action(!) This project is still in the early stage of development.