Generic loadAllRemainingRecords()

Matt SonesMatt Sones 💎💎💎
edited October 15, 2019 in Ideas
A little adaptation of

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.
var $ = skuid.$;
      var model = skuid.model.list()[0];
$.blockUI({ message: 'Loading all available '+model.label+'...' });
         stepCallback: function(offsetStart,offsetEnd) {
            $.blockUI({ message: 'Loading ' + model.label + ' ' + offsetStart + ' to ' + offsetEnd + '...' });
         finishCallback: function(totalRecordsRetrieved) {
            $.blockUI({ message: 'Finished loading all ' + totalRecordsRetrieved + ' ' + model.labelPlural +'!', timeout: 2000 });
3 votes

Awaiting Review · Last Updated


  • edited October 15, 2019
  • Karen WaldschmittKaren Waldschmitt 🛠️ 
    edited March 2, 2017

    Thanks for sharing this with the community!

  • RoyRoy
    edited October 11, 2017
    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?
  • Matt SonesMatt Sones 💎💎💎
    edited October 11, 2017

    Not sure if this will work, but you could try setting
    model.recordsLimit = 500;
    before you load the remaining records.
  • RoyRoy
    edited October 11, 2017
    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!
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!