Hello all - interesting dilemma here. We have been using a third party provider to generate many of our PDF documents, and we’re trying to move away from that. We’ve been building our own Skuid pages and using CSS to get the format correct. Now we want to make it so as soon as the page is finished loading, it automatically calls a print function. I’ve been messing around with this for a few days and have been having some issues - sometimes it will work right and sometimes it won’t, but that’s partly because I had been writing my inline code wrong to begin with. This is my code as it is right now:
(function(skuid){<br> var $ = skuid.$; var models = skuid.model.map(); var SingleSerial = models.SingleSerialNumbers; console.log("1"); console.log(skuid.model.load(SingleSerial)); $.when(skuid.model.load(SingleSerial)).then(function(){ console.log("3"); print(); }); })(skuid);
Basically, we want to give the page time to load the model information before it tries to send the print command. This is the closest I’ve gotten, but I’m pretty sure it’s not loading the model info correctly because the when statement is consistently failing - I can see that in the console, for sure.
I think I’m missing something. I think the model data isn’t loading correctly, so the variable SingleSerial is probably coming up as undefined, which will always lead the when statement to fail. I’m just not sure how to fix that part. Any help would be greatly appreciated.