SmartGWT 2.3 pro
GWT 2.0.3
Firefox 3.6
IDE: SpringSource Tool Suite 2.5.0.M3
I've got a strange problem with a ListGrid and a dataSource with objects with no unique identifier.
The use-case is as follows: before a form is submitted, I need to check for warnings on the form data. These aren't strictly validation errors, instead they're warnings that the user needs to review manually. If the warnings aren't an issue, he can submit the form anyway.
Long story short - I have a number of datasources that create ValidationWarning objects. These validationWarnings contain information about the warning and are show in a number of listgrids (one per type). However, the validation warnings do not have a unique ID (since they aren't persistent objects; they're temporary objects that are generated on demand when the form is submitted).
The first time the form is submitted, everything works fine - the warnings are generated correctly and displayed in their respective listgrids. However, lets say a user decides that the warnings are valid and he modifies the form before resubmitting the data. At this point, I need to check for warnings again.
I'm calling listGrid.invalidateCaches() (to ensure that the listGrid will ask the server for new results). However despite this call, listGrid.willFetchData() returns false; which means I have no way of forcing an update from the server. I've used listGrid.invalidateCaches() before and I never had issues with it in the past; but all those times I was working with persistent objects which had valid unique identifiers, so I suspect that this is the source of the problem. Do I need to somehow generate a unique ID for my temporary warning objects to get around this?
Example of data source file:
As you can see, there's no unique identifier.
Relevant client code:
GWT 2.0.3
Firefox 3.6
IDE: SpringSource Tool Suite 2.5.0.M3
I've got a strange problem with a ListGrid and a dataSource with objects with no unique identifier.
The use-case is as follows: before a form is submitted, I need to check for warnings on the form data. These aren't strictly validation errors, instead they're warnings that the user needs to review manually. If the warnings aren't an issue, he can submit the form anyway.
Long story short - I have a number of datasources that create ValidationWarning objects. These validationWarnings contain information about the warning and are show in a number of listgrids (one per type). However, the validation warnings do not have a unique ID (since they aren't persistent objects; they're temporary objects that are generated on demand when the form is submitted).
The first time the form is submitted, everything works fine - the warnings are generated correctly and displayed in their respective listgrids. However, lets say a user decides that the warnings are valid and he modifies the form before resubmitting the data. At this point, I need to check for warnings again.
I'm calling listGrid.invalidateCaches() (to ensure that the listGrid will ask the server for new results). However despite this call, listGrid.willFetchData() returns false; which means I have no way of forcing an update from the server. I've used listGrid.invalidateCaches() before and I never had issues with it in the past; but all those times I was working with persistent objects which had valid unique identifiers, so I suspect that this is the source of the problem. Do I need to somehow generate a unique ID for my temporary warning objects to get around this?
Example of data source file:
Code:
<DataSource ID="didAccountValidation" serverType="generic"> <fields> <field name="did" type="text" title="DID"/> <field name="message" type="text" title="Message"/> <field name="assignedDate" type="datetime" title="Assigned Date"/> <field name="previousAccount" type="text" title="Previous Account"/> </fields> <serverObject lookupStyle="spring" bean="didAccountValidationDS"/> </DataSource>
Relevant client code:
Code:
public void checkWarnings(Integer[] didIds, Integer accountId, Integer csaId, WarningsCheckedCallback callback) { Log.debug(this.getClass().getName() + " checking for warnings"); reset(); callerCallback = callback; Criteria accountCriteria = new Criteria(); accountCriteria.addCriteria(DIDField.DID_ID_LIST.getName(), didIds); accountCriteria.addCriteria(DIDField.ACCOUNT.getName(), accountId); Criteria csaCriteria = new Criteria(); csaCriteria.addCriteria(DIDField.DID_ID_LIST.getName(), didIds); csaCriteria.addCriteria(DIDField.CSA.getName(), csaId); Log.debug(this.getClass().getName() + " starting RPC queue"); RPCManager.startQueue(); accountWarningGrid.invalidateCache(); if(accountWarningGrid.willFetchData(accountCriteria)){ Log.debug(accountWarningGrid.getClass().getName() + " will fetch server data."); } else { Log.debug(accountWarningGrid.getClass().getName() + " will not fetch server data."); } accountWarningGrid.fetchData(accountCriteria, new DSCallback() { @Override public void execute(DSResponse response, Object rawData, DSRequest request) { accountRet=true; Record[] results = response.getData(); if(results.length > 0) { Log.debug(this.getClass().getName() + " found " + results.length + " account warnings."); foundWarnings=true; accountLayout.setVisibility(Visibility.INHERIT); } else { Log.debug(this.getClass().getName() + " found no account warnings."); } checkProceed(); } }); csaWarningGrid.invalidateCache(); csaWarningGrid.fetchData(csaCriteria,new DSCallback() { @Override public void execute(DSResponse response, Object rawData, DSRequest request) { csaRet=true; Record[] results = response.getData(); if(results.length > 0) { Log.debug(this.getClass().getName() + " found " + results.length + " csa warnings."); foundWarnings=true; csaLayout.setVisibility(Visibility.INHERIT); } else { Log.debug(this.getClass().getName() + " found no csa warnings."); } checkProceed(); } }); RPCManager.sendQueue(); Log.debug(this.getClass().getName() + " rpc queue sent."); }
Comment