You need to sign in to do that
Don't have an account?
bujji
Export All StandarSetController Data to Excel
Hi Guys,
I am displaying data using StandardSetController and pagination, but when i want to export the data, it displaying only current page data but i want all data to be excel.How to achieve it.
Below is the code i am using to display to data.
public ApexPages.StandardSetController contoller{get; set;}
controller = new ApexPages.StandardSetController(Database.getQueryLocator(finalQuery));
controller.setPageSize(200);
public Boolean hasNext
{
get
{
return controller.getHasNext();
}
set;
}
public Boolean hasPrevious
{
get
{
return controller.getHasPrevious();
}
set;
}
Suggest me any idea how to achieve it.
Thanks,
Bujji
I am displaying data using StandardSetController and pagination, but when i want to export the data, it displaying only current page data but i want all data to be excel.How to achieve it.
Below is the code i am using to display to data.
public ApexPages.StandardSetController contoller{get; set;}
controller = new ApexPages.StandardSetController(Database.getQueryLocator(finalQuery));
controller.setPageSize(200);
public Boolean hasNext
{
get
{
return controller.getHasNext();
}
set;
}
public Boolean hasPrevious
{
get
{
return controller.getHasPrevious();
}
set;
}
Suggest me any idea how to achieve it.
Thanks,
Bujji
<apex:page standardController="Account" contentType="application/vnd.ms-excel">
Please refer :- http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_classes_annotation_ReadOnly.htm
http://www.salesforce.com/us/developer/docs/pages/index_Left.htm#StartTopic=Content/pages_controller_readonly_context.htm
Thanks for the reply, if the data is 5000 records and i displayed than it will be tough for the user to scroll down, that's why i am giving pagination. I have custom link on clicking it will generate the report. Is there any way that when i click on the custom link to export the all data in to excel.
Thanks,
Bujji
As currently you set the size to 200 that's why you will be able to download only 200 records.
Thanks for reply, we cannot assign directly StandardSetController to the List<Sobject>, even though how can you export on clicking of custom link. Can you explain detail.
Thanks,
Bujji.
I mean keep using the current solution to display records but to export data, create a custom button/link on UI which will be linked to new VF page designed as I suggested above.
Related sample controller :-
ExportController.cls
So when you click on button/link you will call Export.page, which will dump all data to excel. Let us know if it's not what you are looking for.