Hi Isomorphic,
exportClientData() is a great feature, but has problems when not all data is loaded. I know that above a certain amount exportClientData() does not make a lot of sense because of loading times, rendering times and result-to-server-transfer times, but nowadays this threshold is certainly higher than 75 rows (the default dataPageSize).
What would really help is an automatic download of the missing data, with warnings like "this is going to take some time" and a configurable threshold after that exportClientData() just does not work and requests the user to filter more, a bit like groupByMaxRecords.
Otherwise the export can't be explained to end users. Why is it once 75 rows long, or 150 rows at other times?
I have this code for this, that shows what I mean for the feature:
The 2nd improvement suggestion is about ResultSet.getRange():
As you can see, I have problems above with the asynchronous nature of getRange() combined with the fact that it doesn't have a CallBack. Having a CallBack would greatly simplify the code here (no DataArrivedHandler-add-and-remove-shenanigans).
What do you think?
Best regards
Blama
exportClientData() is a great feature, but has problems when not all data is loaded. I know that above a certain amount exportClientData() does not make a lot of sense because of loading times, rendering times and result-to-server-transfer times, but nowadays this threshold is certainly higher than 75 rows (the default dataPageSize).
What would really help is an automatic download of the missing data, with warnings like "this is going to take some time" and a configurable threshold after that exportClientData() just does not work and requests the user to filter more, a bit like groupByMaxRecords.
Otherwise the export can't be explained to end users. Why is it once 75 rows long, or 150 rows at other times?
I have this code for this, that shows what I mean for the feature:
Code:
if ( // If grouped (workLG.isGrouped() && workLG.getOriginalResultSet() != null && workLG.getOriginalResultSet().lengthIsKnown()) // If ungrouped || (!workLG.isGrouped() && workLG.getResultSet() != null && workLG.getResultSet().lengthIsKnown())) { ResultSet workRS = workLG.isGrouped() ? workLG.getOriginalResultSet() : workLG.getResultSet(); if (workRS.getLength() > 0) { // Otherwise the export will not send a request and the SC.clearPrompt() call below will not be executed, effectively blocking the // application SC.showPrompt(I18nEdited.notification(), I18nEdited.exportStarted()); } // Not all data is loaded clientside, so we load it with workRS.getRange(). In order to trigger the export directly after this // (the method does not have a CallBack, which would make this more easy), DataArrivedHandler is used. This handler is removed // again later in the CallBack of the exportListGrid.exportClientData() call. if (!workRS.allMatchingRowsCached()) { SC.logInfo( StringFormatter.format("Adding DataArrivedHandler to ResultSet {0} of ListGrid {1}", workRS.getID(), workLG.getID())); // Will be removed afterwards again loadAdditionalDataHandler = workRS.addDataArrivedHandler(new DataArrivedHandler() { @Override public void onDataArrived(DataArrivedEvent event) { exportClientData(workLG); } }); workRS.getRange(0, workRS.getLength()); } else { exportClientData(workLG); } } private void exportClientData(ListGrid exportListGrid) { DSRequest exportRequest = getExportRequest(exportListGrid); SC.logInfo(StringFormatter.format("Starting exportClientData of ListGrid {0}", exportListGrid.getID())); exportListGrid.exportClientData(exportRequest, new RPCCallback() { @Override public void execute(RPCResponse response, Object rawData, RPCRequest request) { SC.clearPrompt(); if (loadAdditionalDataHandler != null) { SC.logInfo(StringFormatter.format("Removing DataArrivedHandler of ListGrid {0} added previously", exportListGrid.getID())); loadAdditionalDataHandler.removeHandler(); loadAdditionalDataHandler = null; } SC.logInfo(StringFormatter.format("exportClientData of ListGrid {0} finished", exportListGrid.getID())); } }); }
As you can see, I have problems above with the asynchronous nature of getRange() combined with the fact that it doesn't have a CallBack. Having a CallBack would greatly simplify the code here (no DataArrivedHandler-add-and-remove-shenanigans).
What do you think?
Best regards
Blama
Comment