Hi Isomorphic,
I have succeed to export data from a ListGrid in csv, and applying a custom rendering on columns. This export is returning to the client for "Download".
I would like to know if is it possible to do this with a sort a pagination. This to avoid having memory error / performance leak on the server.
The way I call the export :
This export will call a specific method to customize the data
What I try to do is to have a pagination in the pagRequest.execute() that will return a set of the date to export, and a way to specify to the exportData that the data returned in the response is paginated and the method must be recall.
Is there a way to do this?
Regards
Julien
I have succeed to export data from a ListGrid in csv, and applying a custom rendering on columns. This export is returning to the client for "Download".
I would like to know if is it possible to do this with a sort a pagination. This to avoid having memory error / performance leak on the server.
The way I call the export :
Code:
final DSRequest dsRequestProperties = new DSRequest();
dsRequestProperties.setExportAs("csv");
dsRequestProperties.setExportDisplay(ExportDisplay.DOWNLOAD);
dsRequestProperties.setExportDatesAsFormattedString(true);
dsRequestProperties.setOperationId("export");
dsRequestProperties.setOperationType(DSOperationType.FETCH);
grid.exportData(dsRequestProperties);
Code:
<operationBinding operationType="fetch" operationId="export" dropExtraFields="false"> <serverObject lookupStyle="new" className="com.server.dmi.BaseServerObject" methodName="exportCustomers"/> </operationBinding>
Code:
public DSResponse exportCustomers(DSRequest dsRequest, HttpServletRequest servletRequest) throws Exception {
DataSource dataSource = DataSourceManager.get("dataSource"));
Map criteria = dsRequest.getCriteria();
DSRequest pagRequest = new DSRequest();
pagRequest.setDataSource(dataSource);
pagRequest.setCriteria(criteria);
pagRequest.setOperationType("fetch");
final DSResponse pagResponse = pagRequest.execute();
List<Map<String, Object>> datas = (List<Map<String, Object>>)pagResponse.getData();
for (Map<String, Object> data : datas) {
data.put("CLASSIFICATION",Localization.translate(servletRequest.getLocale(),(String)data.get("CLASSIFICATION")));
}
return pagResponse;
}
Is there a way to do this?
Regards
Julien
Comment