Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Looking for API equvialent to delete for DynamicForm.saveData()

    Hi all,

    this one is probably easy.
    I have a DynamicForm http://www.smartclient.com/smartgwte...namicForm.html.

    I added "Delete"-Button below that should delete the row in the DynamicForm from the database.
    My "Save"-Button calls DynamicForm.saveData(), but what should the "Delete"-Button call?

    As DynamicForm already has "getRemoveOperation()" there must be a way to call it.

    Thank you,
    Blama

    #2
    Hi Blama

    I had a similar issue for that I used submitForm() instead, this can be done by setting df.setAction(String URL) and then setting df.canSubmit(true).

    There may be a better way though. Just my 2 cents.

    Comment


      #3
      No, not correct, use DataSource.removeData() and pass the primary key. Submitting HTML forms is a legacy approach that should not be used unless you are working around the constraints of some legacy server logic.

      Comment


        #4
        Hi Isomorphic,

        that is exactly what I did!

        Code:
        Record r = new Record() {
        	{
        		setAttribute("ID", dateForm.getValue("ID"));
        	}
        };
        datumDS.removeData(r, new DSCallback() {
        	@Override
        	public void execute(DSResponse response, Object rawData, DSRequest request) {
        		dateForm.clearValues();
        	}
        });
        Nice to see that I get used to thinking the Smart GWT way.
        In my case, I added the DSCallback shown above as I'd expect the DynamicForm to be "clean" after the delete. Should the form recognize on its own or has it to be done the way I did it?

        Best regards,
        Blama

        Comment

        Working...
        X