1. SmartGWT version: v8.3p_2013-03-17/PowerEdition Deployment 2013-03-17
2. Browser: FF 19 dev mode
I have a DynamicForm with a simple vertical layout: a FileItem, a ButtonItem, and a CanvasItem which contains an Img. This DynamicForms is backed by a vanilla SQLDataSource.
This DynamicForm can be told to "fetch" an image from the database and load it into the Img.
The user can use the FileItem to upload a new photo, the process of which is fired by the ButtonItem, however due to the business logic I'm running, both update and add operations go through a DMI such that any new uploads into the database are marked "temporary". This way the new upload will not linked to the parent object until the parent object is saved. Essentially, parent_id in the photo table is null until the parent object is saved and if the user cancels from the modal dialog the newly uploaded photo in the database is never linked to the parent object and remains orphaned.
I was seeing that no matter what I did, the update operation fired when the form was saved did not go through the DMI/operationId I specified.
The form is created with:
Here is the DataSource excerpt, where I've redirected fetch/update/add into a dumb do-default DMI.
Below you can see two fetches (two instances of these DynamicForms) going into the DMI. One of them returns something useful, and I use datasource.getFileURL to load the photo into the Img.
When I click the upload button, it initiates a saveData on the form. However, the update operation does not go through the DMI
You will notice that the component which caused the update to happen is not the original form which created the fetch. In the Watch tab of the Developer Console I see this:
When I've selected the "isc_DynamicForm_20" item, the component that gets highlighted is the FileItem! According to the API, the FileItem is not a subclass of the DynamicForm.
1) What is going on with the extra "isc_DynamicForm_20" being shown as the FileItem?
2) Why isn't the update operation respecting the DMI/setUpdateOperation specified on the DynamicForm?
2. Browser: FF 19 dev mode
I have a DynamicForm with a simple vertical layout: a FileItem, a ButtonItem, and a CanvasItem which contains an Img. This DynamicForms is backed by a vanilla SQLDataSource.
This DynamicForm can be told to "fetch" an image from the database and load it into the Img.
The user can use the FileItem to upload a new photo, the process of which is fired by the ButtonItem, however due to the business logic I'm running, both update and add operations go through a DMI such that any new uploads into the database are marked "temporary". This way the new upload will not linked to the parent object until the parent object is saved. Essentially, parent_id in the photo table is null until the parent object is saved and if the user cancels from the modal dialog the newly uploaded photo in the database is never linked to the parent object and remains orphaned.
I was seeing that no matter what I did, the update operation fired when the form was saved did not go through the DMI/operationId I specified.
The form is created with:
Code:
public class PhotoForm extends DynamicForm public PhotoForm() { // init code goes here this.setUpdateOperation("dmitest"); this.setAddOperation("dmitest"); this.setFetchOperation("dmitest"); }
Code:
<DataSource ID="medication_photo" serverType="sql" tableName="medication_photo" autoDeriveSchema="true"> <operationBindings> <operationBinding operationType="update" operationId="dmitest"> <serverObject className="com.test.dmi.TestDMI" methodName="dmitest"/> </operationBinding> <operationBinding operationType="fetch" operationId="dmitest"> <serverObject className="com.test.dmi.TestDMI" methodName="dmitest"/> </operationBinding> <operationBinding operationType="add" operationId="dmitest"> <serverObject className="com.test.dmi.TestDMI" methodName="dmitest"/> </operationBinding> </operationBindings> </DataSource>
When I click the upload button, it initiates a saveData on the form. However, the update operation does not go through the DMI
You will notice that the component which caused the update to happen is not the original form which created the fetch. In the Watch tab of the Developer Console I see this:
When I've selected the "isc_DynamicForm_20" item, the component that gets highlighted is the FileItem! According to the API, the FileItem is not a subclass of the DynamicForm.
1) What is going on with the extra "isc_DynamicForm_20" being shown as the FileItem?
2) Why isn't the update operation respecting the DMI/setUpdateOperation specified on the DynamicForm?
Comment