Getting Heap Size error, but 'Max # of records (Limit)' is not working for me.

Hi, I have two skuid pages and when I load a good number of data (for ex, even 17,000 records) on my pages, then it shows the heap size error stating ‘Apex heap size too large’. I have already tried putting the ‘Max # of records (Limit)’, it worked for one page but the other page is still showing the same error. Also, there is a button on the page (which started working fine after putting the limit), which changes the status of one of the fields on being clicked. But, unfortunately it is only changing the status of the records which are being displayed on the page after putting the limit and not of all the records in the database. But I need to change the status of all the records in one go (which is the actual requirement). Can you please suggest a better approach to deal with this heap size error, as setting the limit dosen’t seem to be working for me and the client needs all the records to be loaded automatically in one go on page load and he won’t have to press the ‘Load More’ option all the time. If the solution could be achieved by standard features of skuid then it is the best thing, but if there is any custom js code to achieve the solution, then please share it here and guide me how to put it in the editor and from where to call it as I am new to Skuid. I could have read the skuid documents to learn more about the skuid pages development but it will consume more time and at present I have got this issue by client who needs the solution on urgent basis. Kindly help me in getting this issue resolved, I need the solution urgently. Your help will be highly appreciated.

Suggest you review this discussion:

Thanks for the above link. Using that, I got below code which helped me in getting all the data on page load. 
var $ = skuid.$;
      var model = skuid.model.list()[2];
      model.recordsLimit = 500;
      $.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 });

But, there are some filters on my page, when I apply any filter, it again starts displaying data in chunks, and I have to press ‘Load More’ action to display more records. Need to know, how can I make the above code work even when I apply any filters. As, there is no option to add action on these filters, then from where I can call this snippet and how can I make my functionality run as expected (i.e load all the data in one go even after applying filters). Please suggest the best. If there is any way the above code could work for my requirement, then please share how to make it happen & where to call this snippet, and the above code is for page load, so on selection of any filter if this code needs any modification then please share the modified code with me as I have not much knowledge about js. Thanks for the help in advance.

You can use a model action and use the trigger point of “Model Requeried” to run your snippet.  Note that your script is an inline resource and you’ll need to convert it to a snippet.