function readOnly(count){ }
Don't have an account?
Search for an answer or ask a question of the zone or Customer Support.
You need to sign in to do that
Sign in to start searching questions
Signup for a Developer Edition
Sign in to start a discussion
Visualforce Page:- <apex:page controller="Question"> <apex:form > <apex:pageBlock id="details" title="Details"> <apex:dataList value="{!Account}" var="acc" > <apex:outputText value="{!acc.Id}" /> <apex:outputText value="{!acc.Name}"/> </apex:dataList> <apex:pageBlockButtons> <apex:commandButton value="First" rerender="details" action="{!beginning}" disabled="{!prev}"/> <apex:commandButton value="Previous" rerender="details" action="{!previous}" disabled="{!prev}"/> <apex:commandButton value="Next" rerender="details" action="{!next}" disabled="{!nxt}"/> <apex:commandButton value="Last" rerender="details" action="{!end}" disabled="{!nxt}"/> </apex:pageBlockButtons> </apex:pageBlock> </apex:form> </apex:page> Apex Class:- public class Question{ private integer totalRecords = 0; private integer index = 0; private integer blockSize = 10; public Question() { totalRecords = [select count() from Account limit 200]; } public List<Account> getAccount() { List<Account> accRecords = Database.Query('SELECT Id,Name FROM Account LIMIT : blockSize OFFSET :index'); System.debug('Values are ' + accRecords); return accRecords; } public void beginning() { index = 0; } public void previous() { index = index - blockSize; } public void next() { index = index + blockSize; } public void end() { index = totalRecords - math.mod(totalRecords,blockSize); } public boolean getprev() { if(index == 0) return true; else return false; } public boolean getnxt() { if((index + blockSize) > totalRecords) return true; else return false; } }
You can get different IDs and display all records of a particular object on this code.
Please check below code:
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks and Regards,
Deepali Kulshrestha
www.kdeepali.com