function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Surgaya KhundrakpamSurgaya Khundrakpam 

Visualforce page gives unresponsive error while loading too many data

Hi,
Visualforce page gives unresponsive error while loading records around 2000+.
I added readOnly= true in the apex:Page tag but didn't help.

But still I am getting this error . Please help.
User-added image
bob_buzzardbob_buzzard
Changing the page to readonly won't affect the time that it is taking to retrieve the records. If you are pulling a lot of fields back for each record that will take time and consume a lot of bandwidth, so you probably want to reduce the fields to the absolute minimum you want to display.
Surgaya KhundrakpamSurgaya Khundrakpam
Thanks @bob_buzzard. 
Is there any work around other than pagination. I dont want to use pagination on this.
bob_buzzardbob_buzzard
If you aren't going to let the users change the records, make them transient in the controller - that will remove them from the viewstate.
Varun PareekVarun Pareek
Are you using JavaScript in your code? Generally, 2K records is not that big a number.
Surgaya KhundrakpamSurgaya Khundrakpam

Hi @Varun Pareek,
Yes I do Have JavaScript in the code . The thing is these 2000+ records are displayed using accordian as a heading and inside each accordian there are another 200 records displayed. And these processing is handled in javascript code.

Also I checked the View State of the page its hardly 1.89. So I am not sure where Iam going wrong.
Varun PareekVarun Pareek
Looking at the unresponsiveness of the page, I suspect not well written JS which may be causing memory leak and thus making your broswer unresponsive. I would suggest you to remove/comment the JS just to debug this issue. Once you do that and you see any noticeable changes, you would be able to drill down to the JS issue, if that being the root cause. Also try using the browser console tool to see any JS errors on your page.
Surgaya KhundrakpamSurgaya Khundrakpam

Thanks Varun.
I have added lazy loading for now.  This works well.
Varun PareekVarun Pareek
Awesome.

P.S - You may want to mark the post as solved to help others.