Skip to main content
Nintex Community Menu Bar

A little adaptation of http://help.skuid.com/m/11720/l/205447-skuid-model-model#loadAllRemainingRecords

All this inline script to any page, and it will load all the records for the first model of the page and display the nice loading messages. This is handy if you have a list view page and want to load all the rows, but you want to do it in chunks to avoid heap size limits.

I made it generic so I could reuse the same static resource on multiple pages.


(function(skuid){<br>var $ = skuid.$;<br>$(document.body).one('pageload',function(){<br>&nbsp; &nbsp; &nbsp; var model = skuid.model.list()(0];<br> $.blockUI({ message: 'Loading all available '+model.label+'...' });<br>&nbsp; &nbsp; &nbsp; model.loadAllRemainingRecords({<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;stepCallback: function(offsetStart,offsetEnd) {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $.blockUI({ message: 'Loading ' + model.label + ' ' + offsetStart + ' to ' + offsetEnd + '...' });<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;},<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;finishCallback: function(totalRecordsRetrieved) {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $.blockUI({ message: 'Finished loading all ' + totalRecordsRetrieved + ' ' + model.labelPlural +'!', timeout: 2000 });<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br>&nbsp; &nbsp; &nbsp; });<br>});<br>})(skuid);

Nice


Matt~

Thanks for sharing this with the community!

Karen


hey Matt, thanks for this! is there a way to specify the load batch size for this? the initial limit on my model is 50 (total records are 2000+) when I do a loadAllRemainingRecords() I see that records are retrieved in batches for 50 again and this takes long, is there a way I can set the next batch size to 500? or does skuid determine that internally?


Royston,

Not sure if this will work, but you could try setting


model.recordsLimit = 500;

before you load the remaining records.


Hi Matt, that worked. I thought that would improve performance, but apparently 1 trip to get 500 records and  5 trips to get 100 records/trip amounts to the same. anyway thanks for your reply!