Announcement

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

    ValuesManager isNewRecord clarification

    Should a ValuesManager report isNewRecord()==true following a call to saveData? Seems like it should be smart enough to set that to false when it gets the key back in the response... Similarly, I was surprised to find that the operation type is not reset to update? If I'm not mistaken, DynamicForms behave this way.

    e.g.,

    Code:
    public void onModuleLoad() {
    
    		VLayout layout = new VLayout();
    		layout.setWidth100();
    		layout.setHeight100();
    		
    		DataSource ds = DataSource.get("Order");
    
    		DynamicForm form = new DynamicForm();
    		form.setWidth(500);  
    		
    		final ValuesManager vm = new ValuesManager();
    		vm.setDataSource(ds);
    		
    		form.setDataSource(ds);
    		form.setValuesManager(vm);
    
    		IButton save = new IButton("Save");
    		save.addClickHandler(new ClickHandler() {
    			@Override
    			public void onClick(ClickEvent event) {
    				vm.saveData(new DSCallback() {
    					@Override
    					public void execute(DSResponse response, Object rawData, DSRequest request) {
    						GWT.log("Has key: " + vm.getValueAsString("ORDERID"));
    				                GWT.log("New record: " + vm.isNewRecord().toString());
    				                GWT.log("Operation Type: " + vm.getSaveOperationType().toString());
    					}
    				});
    			}
    		});
    		
    		IButton state = new IButton("Log");
    		state.addClickHandler(new ClickHandler() {
    			
    			@Override
    			public void onClick(ClickEvent event) {
    				GWT.log("Has key: " + vm.getValueAsString("ORDERID"));
    				GWT.log("New record: " + vm.isNewRecord().toString());
    				GWT.log("Operation Type: " + vm.getSaveOperationType().toString());
    			}
    		});
    		
    		layout.addMembers(form, save, state);
    		
    		vm.editNewRecord();
    		layout.draw();
    Yields

    Code:
    Has key: 11
    New record: true
    Operation Type: ADD
    If I remove references to the valuesManager and instead invoke corresponding methods on the form directly, I get what I expect:

    Code:
    Has key: 12
    New record: false
    Operation Type: UPDATE
    (3.1.d 7/21/2012)
    Last edited by bbruyn; 25 Jul 2012, 13:15.

    #2
    (crickets chirping)

    Comment


      #3
      Sorry Bill :) Don't worry, it's been assigned and should be looked into today.

      Comment


        #4
        @bbruyn: I posted this issue a while ago, see: http://forums.smartclient.com/showthread.php?t=18196 .

        Currently I simply call editRecord after successful save of a new record.

        Anyway nice to see this gets some attention:)

        Comment


          #5
          A quick update to let you know this isn't forgotten. We are seeing the problem and should have a solution in the next couple of days. In the meantime the workaround of calling editRecord should work for you.

          Comment


            #6
            We've made a change which should address this in the 3.1d branch. Should be hitting nightly builds tonight so will be present in the build dated Aug 3 or greater.

            Regards
            Isomorphic Software

            Comment


              #7
              Great, thanks

              Comment

              Working...
              X