Announcement

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

    not editable BooleanItem rendered differently on grid and form

    Datasource field of type boolean with canEdit=false is nicely rendered in the ListGrid, however it is not when used on DynamicForm.
    Both are fine when canEdit=true.

    canEdit = true


    canEdit = false


    Code:
    package org.yournamehere.client;
    
    import com.google.gwt.core.client.EntryPoint;
    import com.google.gwt.user.client.ui.RootPanel;
    import com.smartgwt.client.data.DataSource;
    import com.smartgwt.client.data.fields.DataSourceBooleanField;
    import com.smartgwt.client.widgets.Canvas;
    import com.smartgwt.client.widgets.form.DynamicForm;
    import com.smartgwt.client.widgets.grid.ListGrid;
    import com.smartgwt.client.widgets.grid.ListGridRecord;
    import com.smartgwt.client.widgets.layout.VLayout;
    
    public class MainEntryPoint implements EntryPoint {
    
        public MainEntryPoint() {
        }
    
        public void onModuleLoad() {
            RootPanel.get().add(getCanvas());
        }
    
        public Canvas getCanvas() {
    
            VLayout layout = new VLayout();
    
            DataSource ds = new DataSource();
            ds.setClientOnly(true);
    
            DataSourceBooleanField booleanField = new DataSourceBooleanField("yesno");
            booleanField.setCanEdit(false);
            ds.addField(booleanField);
    
            ListGridRecord[] records = new ListGridRecord[1];
            records[0] = new ListGridRecord();
            records[0].setAttribute("yesno", true);
    
            ListGrid list = new ListGrid();
            list.setDataSource(ds);
            list.setData(records);
            list.selectRecord(0);
    
            DynamicForm form = new DynamicForm();
            form.setDataSource(ds);
            form.editSelectedData(list);
    
            layout.addMember(list);
            layout.addMember(form);
    
            return layout;
        }
    
    }
    Would it be corrected soon ? Any workaround suggestions ?
    Tnanks,
    MichalG
    ps
    SmartGWT svn 1307, GWT-2.0.3

    #2
    In the ListGrid the DataSourceField is rendered correctly and on the form it's shown as a static text.

    Comment


      #3
      Right. On the DynamicForm it is rendered as static text:
      Label: true
      and not even respecting localization.

      Still hope that it is going to be improved...
      MichalG

      Comment


        #4
        Just a thought for a work-around: set canEdit to true then capture and ignore mouse clicks.

        Comment


          #5
          Originally posted by evanross
          Just a thought for a work-around: set canEdit to true then capture and ignore mouse clicks.
          Probably I will end with this kind of workaround when our application reach production stage, but ... I still think that such a defect should be corrected at library level.
          Thanks,
          MichalG

          Comment

          Working...
          X