Announcement

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

    Getting generated key after saveData

    This is my code. i know its wrong because it returns null in the message there I print. What am I doing wrong.

    The insert its done but I don't get the generated key.

    What I want is to obtain the generated key after the insert is completed on the database.

    Have a good time.

    Code:
    final Button btn_guardar = new Button("Guardar");
    			btn_guardar.setWidth(140);
    			btn_guardar.setIcon("icons/guardar.png");
    			btn_guardar.addClickHandler(new ClickHandler() {
    				
    				@Override
    				public void onClick(ClickEvent event) {
    					form_altapedido.saveData(new DSCallback() {
    						
    						@Override
    public void execute(DSResponse response, Object rawData, DSRequest request) {
    		Record rs[] = response.getData();
    		 String id2 = rs[0].getAttributeAsString("id");
    		System.out.println("after request is completed this method is executed" + id2);
    						}
    					});
    
    				}
    			});

    #2
    Only need to post once. Have a look at http://forums.smartclient.com/showthread.php?t=5561&highlight=generated+key

    Comment


      #3
      Hi, Thanks for the reply svjard but that solution didn't work out for me.

      Because he is using XML, and I am using JSON. For example the function setResponseDataSchema(getInstance()); don't work for me.

      What can I do.

      Thanks in advance.

      Comment

      Working...
      X