Announcement

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

    ListGrids with CanvasItems -> editors are not always shown

    I have a listgrid with one listgriditem that has a canvasitem (a dynamicform with 2 fields) as editortype.
    When I set "alwaysShowEditors" to true, all the editors should always be visible. This is not the case for my listgriditem with the canvasitem as editor. This editor is only shown for the selected record. Besides that the editor is not shown, the cellformatter (for that cell) doesn't do it's work neither.

    The following code reproduces this error:
    Code:
    package test.client;
    
    import com.google.gwt.core.client.EntryPoint;
    import com.smartgwt.client.data.DataSource;
    import com.smartgwt.client.data.DataSourceField;
    import com.smartgwt.client.data.Record;
    import com.smartgwt.client.data.fields.DataSourceIntegerField;
    import com.smartgwt.client.data.fields.DataSourceTextField;
    import com.smartgwt.client.widgets.form.DynamicForm;
    import com.smartgwt.client.widgets.form.fields.CanvasItem;
    import com.smartgwt.client.widgets.form.fields.StaticTextItem;
    import com.smartgwt.client.widgets.form.fields.TextItem;
    import com.smartgwt.client.widgets.grid.CellFormatter;
    import com.smartgwt.client.widgets.grid.ListGrid;
    import com.smartgwt.client.widgets.grid.ListGridField;
    import com.smartgwt.client.widgets.grid.ListGridRecord;
    import com.smartgwt.client.widgets.layout.VLayout;
    
    /**
     * Entry point classes define <code>onModuleLoad()</code>.
     */
    public class Test implements EntryPoint {
    	
    	private VLayout vLayout;
    	
    	public void onModuleLoad() {
    		vLayout = new VLayout();
    		
    		final DataSource dataDS = new DataSource(){{
    			setID("DataDS");
    			DataSourceIntegerField idField = new DataSourceIntegerField("id");
    			idField.setHidden(true);
    			idField.setPrimaryKey(true);
    			DataSourceTextField userId = new DataSourceTextField("uid");
    			DataSourceTextField userFirstName = new DataSourceTextField("firstName");
    			
    			setFields(new DataSourceField[]{
    				idField,userId,userFirstName
    			});
    			
    			Record[] testData = new Record[2];
    			Record record = new Record();
    			record.setAttribute("id", 1);
    			record.setAttribute("uid", "uid"+1);
    			record.setAttribute("userFirstName", "first"+1);
    			testData[0] = record;
    			record = new Record();
    			record.setAttribute("id", 2);
    			record.setAttribute("uid", "uid"+2);
    			record.setAttribute("userFirstName", "first"+2);
    			testData[1] = record;
    			
    			setTestData(testData);
    			setClientOnly(true);
    		}};
    		
    		ListGrid grid = new ListGrid();
    		grid.setAutoFetchData(true);
    		grid.setDataSource(dataDS);
    		grid.setAlwaysShowEditors(true);
    		
    		ListGridField firstGridField = new ListGridField("uid");
    		ListGridField secondGridField = new ListGridField("userFirstName");
    		secondGridField.setEditorType(new CanvasItem(){
    			{
    				DynamicForm wrapperForm = new DynamicForm();
    				wrapperForm.setNumCols(2);
    				TextItem value = new TextItem();
    				value.setValue("editValue");
    				value.setShowTitle(false);
    				StaticTextItem staticText = new StaticTextItem();
    				staticText.setValue("st");
    				staticText.setWidth(20);
    				staticText.setShowTitle(false);
    				wrapperForm.setItems(value,staticText);
    				wrapperForm.setMargin(0);
    				wrapperForm.setPadding(0);
    				wrapperForm.setCellPadding(0);
    				setCanvas(wrapperForm);
    			}
    		});
    		secondGridField.setCellFormatter(new CellFormatter() {
    			@Override
    			public String format(Object value, ListGridRecord record, int rowNum,
    					int colNum) {
    				return "editValue";
    			}
    		});
    		grid.setFields(firstGridField,secondGridField);
    		
    		vLayout.addMember(grid);
    		vLayout.setWidth(400);
    		vLayout.setHeight(400);
    		
    		vLayout.draw();
    	}
    }
    I'm using the following version:
    SmartClient Version: v8.2p_2012-07-13/PowerEdition Deployment (built 2012-07-13)

    #2
    I have tried this with the latest nightly build (v8.2p_2012-09-25/PowerEdition Deployment (built 2012-09-25)) and the problem is still there...

    Comment


      #3
      Do you have enough information to replicate the problem?

      Comment

      Working...
      X