Announcement

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

    Can't get ImplicitSaveOnBlur to work.

    SmartClient Version: v11.0p_2016-04-26/Pro Deployment (built 2016-04-26)

    Hi, I have a DynamicForm and I have set implicitSave and implicitSaveOnBlur to true but the form still doesn't update when I tab from field to field or focus something completely different.

    I may have misunderstood how it is supposed to work but I though that the form would save immediately when an items blurs, but it always waits for the delay before saving.
    Am I missing something?

    Here is a small test case
    Code:
        private Layout getLayout() {
            HLayout mainLayout = new HLayout();
            
            DataSource ds = DataSource.get("test");
            
            DynamicForm form = new DynamicForm();
            form.setDataSource(ds);
            form.setImplicitSave(true);
            form.setImplicitSaveOnBlur(true);
            form.setImplicitSaveDelay(20000);
            form.fetchData(new Criteria("id", "1"));
            mainLayout.addMember(form);
            return mainLayout;
        }
    Code:
    <DataSource 
        ID="test" 
        serverConstructor="TestServlet">
         <fields>
            <field name="id"        type="sequence"    primaryKey="true" hidden="true"    />
            <field name="field1"                                            />
            <field name="field2"                                            />
         </fields>
    </DataSource>
    Code:
    import java.util.ArrayList;
    import java.util.HashMap;
    import java.util.List;
    import java.util.Map;
    
    import com.isomorphic.datasource.BasicDataSource;
    import com.isomorphic.datasource.DSRequest;
    import com.isomorphic.datasource.DSResponse;
    
    public class TestServlet extends BasicDataSource {
        
        public DSResponse executeFetch(DSRequest req) throws Exception {  
            Map map = fetchRecords(req.getCriteria());  
            return new DSResponse(map);  
        }
        
        public DSResponse executeUpdate(DSRequest req) throws Exception {
            Map map = updateRecord(req.getValues());
            
            return new DSResponse(map);
        }
        
        private Map fetchRecords (Map criteria) {  
            
            System.out.println("Fetch called!");
            
            List<Map> list = new ArrayList<>();
    
            Map<String, Object> map = new HashMap<>();
            map.put("id", 1);
            map.put("field1", "test1");
            map.put("field2", "test2");
            list.add(map);
    
            return map;  
        }  
    
        private Map updateRecord (Map values) {  
            return values;
        }
    }

    #2
    This has been fixed and the doc tweaked to clarify that implicitSaveOnBlur is indeed expected to cause an immediate save, on blur(), not a delayed save after implicitSaveDelay.

    You can test out the fixes in builds dated May 27 and later.
    Last edited by Isomorphic; 26 May 2016, 03:52.

    Comment


      #3
      Just tested and it works now. Thank you.

      Comment

      Working...
      X