So, I have a multiform canvas with about 5 forms, all using a values manager. When I click on a listgrid row, I can vm.editedSelectedData ( record). I can edit this data multiple times, hit a button that does SaveData, and then the forms do not clear, they just stay. I can edit more data, and hit save and it does an Update accordingly.
Now, if I go back to my listgrid, and select another row, even though this record is an existing record, when I do a SaveData, it does an add.
I have done a million things to resolve this issue. I even set the operationType to UPDATE, but this did not work when it gets to the datasource ....
I am using SmartGWT 5.0-p20160927 and when I test this I am using old firefox 24.
Here is the code for when I doubleclick a row in the listgrid:
Here is the code that I use to save this record to the database:
Here is the button for a new record:
Any help on what I am doing wrong would be much appreciated.
Now, if I go back to my listgrid, and select another row, even though this record is an existing record, when I do a SaveData, it does an add.
I have done a million things to resolve this issue. I even set the operationType to UPDATE, but this did not work when it gets to the datasource ....
I am using SmartGWT 5.0-p20160927 and when I test this I am using old firefox 24.
Here is the code for when I doubleclick a row in the listgrid:
Code:
accountListGrid.addRecordDoubleClickHandler(new RecordDoubleClickHandler() { @Override public void onRecordDoubleClick(RecordDoubleClickEvent event) { vm.resetValues(); accountBasicInfoForm.setDisabled(false); accountAddressBillingForm.setDisabled(false); accountAddressShippingForm.setDisabled(false); accountContactInfoForm.setDisabled(false); accountPrimaryContactForm.setDisabled(false); vm.editSelectedData(accountListGrid); // specifically setting the UPDATE operation vm.setSaveOperationType(DSOperationType.UPDATE); accountBasicInfoForm.setEditedBy(_userId); vm.setValue(AppConstants.ACCOUNT_EDITED_BY, _userId); topTabSet.selectTab(1); } });
Code:
submitButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { vm.saveData(new DSCallback() { @Override public void execute(DSResponse dsResponse, Object data, DSRequest dsRequest) { if (dsResponse.STATUS_SUCCESS == 0) { SC.say("Account", "SuccessFully Filed Account!!!"); // make sure we are re - editing the record we just saved vm.editSelectedData(accountListGrid); } else { SC.say("Account", "Failed to Submit Account!!!"); } } }); } });
Here is the button for a new record:
Code:
newAccountButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { // SC.say("button clicked"); topTabSet.selectTab(1); accountBasicInfoForm.setDisabled(false); accountAddressBillingForm.setDisabled(false); accountAddressShippingForm.setDisabled(false); accountContactInfoForm.setDisabled(false); accountPrimaryContactForm.setDisabled(false); vm.editNewRecord(); // specifically setting the ADD operation vm.setSaveOperationType(DSOperationType.ADD); accountBasicInfoForm.setAccountOwner(_userId); vm.setValue(AppConstants.ACCOUNT_OWNER, _userId); accountBasicInfoForm.setEnteredBy(_userId); vm.setValue(AppConstants.ACCOUNT_ENTERED_BY, _userId); accountBasicInfoForm.setEditedBy(_userId); vm.setValue(AppConstants.ACCOUNT_EDITED_BY, _userId); } });