Announcement

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

    Data of TreeGrid is not synchronized when clearing a value

    For instance if there is a datasource bound to both a DynamicForm and a TreeGrid and you alter a value in the form, it updates the value in the TreeGrid.
    But if you make a value empty in the form and save it, the value in the TreeGrid does not change.

    I've made a test case, tested on:
    - Smart GWT Power Edition (3.0p 2012-05-04 nightly)
    - GWT 2.1.0
    - FireFox 10

    EntryPoint class:
    Code:
    package test.client;
    
    import com.google.gwt.core.client.EntryPoint;
    import com.smartgwt.client.data.DataSource;
    import com.smartgwt.client.widgets.Button;
    import com.smartgwt.client.widgets.events.ClickEvent;
    import com.smartgwt.client.widgets.events.ClickHandler;
    import com.smartgwt.client.widgets.form.DynamicForm;
    import com.smartgwt.client.widgets.grid.events.RecordClickEvent;
    import com.smartgwt.client.widgets.grid.events.RecordClickHandler;
    import com.smartgwt.client.widgets.layout.HLayout;
    import com.smartgwt.client.widgets.layout.VLayout;
    import com.smartgwt.client.widgets.tree.TreeGrid;
    import com.smartgwt.client.widgets.tree.TreeGridField;
    
    /**
     * Entry point classes define <code>onModuleLoad()</code>.
     */
    public class Test implements EntryPoint {
    	
    	private HLayout hLayout;
    	private TreeGrid treeGrid;
    	private DynamicForm dynamicForm;
    	private Button saveButton;
    	
    	public void onModuleLoad() {
    		hLayout = new HLayout();
    		
    		addToLayout();
    		
    		hLayout.draw();
    	}
    	
    	private void addToLayout() {
    		DataSource ds = DataSource.get("Content");
    		
    		treeGrid = new TreeGrid();
    		treeGrid.setWidth(400);
    		treeGrid.setHeight(200);
    		treeGrid.setDataSource(ds);
    		treeGrid.setAutoFetchData(true);
    		treeGrid.addRecordClickHandler(new RecordClickHandler() {			
    			@Override
    			public void onRecordClick(RecordClickEvent event) {
    				dynamicForm.editRecord(event.getRecord());				
    			}
    		});
    		
    		TreeGridField idField = new TreeGridField("cntn_id");  
            idField.setTreeField(true);  
            TreeGridField modifiedField = new TreeGridField("cntn_modifiedBy");
            treeGrid.setFields(idField, modifiedField);
            
    		hLayout.addMember(treeGrid);
    				
    		VLayout vLayout = new VLayout();
    		dynamicForm = new DynamicForm();
    		dynamicForm.setDataSource(ds);
    		vLayout.addMember(dynamicForm);
    
    		saveButton = new Button("Save");
    		saveButton.addClickHandler(new ClickHandler() {			
    			@Override
    			public void onClick(ClickEvent event) {
    				dynamicForm.saveData();				
    			}
    		});		
    		vLayout.addMember(saveButton);		
    		hLayout.addMember(vLayout);
    	}
    	
    }
    DataSource:
    Code:
    <DataSource ID="Content" serverType="sql" tableName="Content">
    	<fields>
    		<field primaryKey="true" type="sequence" name="cntn_pk" hidden="true"></field>
    		<field title="id" type="text" name="cntn_id"></field>
    		<field title="modified" type="text" name="cntn_modifiedBy"></field>
    		<field title="original" type="integer" name="cntn_fk_originalContent" foreignKey="Content.cntn_pk"></field>
    	</fields>
    </DataSource>
    If for instance you set the 'modified' field back empty in the form, the TreeGrid still contains the record with the original value for the 'modified' field.
    This problem does not occur when using a default ListGrid.

    Could you please look into this?

    #2
    We are investigating this issue and appear to be reproducing the problem. We'll let you know when we have a solution

    Regards
    Isomorphic Software

    Comment


      #3
      Any news on this issue?

      Comment


        #4
        A fix for this has been added for 3.1d and we just now have ported it to 3.0p.
        Last edited by Isomorphic; 16 May 2012, 10:43.

        Comment

        Working...
        X