I’m currently trying to implement a feature which opens a different random record from the model on each button click.
This is as far as I got with my snippet:
var Model = skuid.model.getModel('Images'); <br>var rows = Model.data.length;<br>var randomNum = Math.floor(Math.random() * rows) + 1;<br>var Link = skuid.model.getModel('Images').data.row[randomNum].Link__c; window.open(Link, '_blank');
The “Link__c” field contains a valid URL of an image. What I am struggling with are 2 things:
1) Correct syntax to call a specific row in the model
2) Correct implementation of producing a random number, and then passing this on to retrieve the corresponding row
Thank you in advance!