Announcement

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

    ListGridField.canHilite not working

    Be sure your post includes:

    1.SmartClient Version: v10.0p_2014-10-26/LGPL Development Only (built 2014-10-26)

    2. FF 24.8.0 on Gentoo linux

    3.

    4.

    5.

    6. sample code if applicable
    Code:
    package pl.com.tech4.client;
    
    import com.google.gwt.core.client.EntryPoint;
    import com.google.gwt.user.client.DOM;
    import com.smartgwt.client.data.DataSource;
    import com.smartgwt.client.data.DataSourceField;
    import com.smartgwt.client.data.fields.DataSourceTextField;
    import com.smartgwt.client.util.SC;
    import com.smartgwt.client.widgets.grid.ListGrid;
    import com.smartgwt.client.widgets.grid.ListGridField;
    
    public class MainEntryPoint implements EntryPoint {
        
        public void onModuleLoad() {
    
            DOM.getElementById("loadingPicture").removeFromParent();
            layout();
            SC.showConsole();
        }
        
        private void layout() {
            
            final DataSource ds = new DataSource();
            DataSourceField fieldId = new DataSourceField();
            fieldId.setName("id");
            fieldId.setPrimaryKey(true);
            fieldId.setHidden(true);
            DataSourceTextField fieldCode = new DataSourceTextField();
            fieldCode.setName("code");
            DataSourceTextField fieldDescription = new DataSourceTextField();
            fieldDescription.setName("description");
            ds.setFields(fieldId, fieldCode, fieldDescription);
            
            ListGrid lg = new ListGrid();
            ListGridField lgfDescription = new ListGridField("description");
            lgfDescription.setCanHilite(false);
            lg.setFields(lgfDescription);
            lg.setDataSource(ds);
            lg.editHilites();
    
            lg.draw();
        }
    }
    This problem has been also mentioned in this unanswered post.
    Thanks,
    MichalG
    Attached Files

    #2
    Do not call editHilites() before draw(). This makes no sense as a UI for a real application, and happens to cause the ListGrid to start the Hilites Dialog before the listGrid fields have been looked at.

    Note also: there was no bug in the linked thread, just a usage issue (see our response there for details).

    Comment


      #3
      Thank you for mention ListGrid.editHilites() before draw(). I did it this way just to simplify example. The corrected test case:
      Code:
      package pl.com.tech4.client;
      
      import com.google.gwt.core.client.EntryPoint;
      import com.google.gwt.user.client.DOM;
      import com.smartgwt.client.data.DataSource;
      import com.smartgwt.client.data.DataSourceField;
      import com.smartgwt.client.data.fields.DataSourceTextField;
      import com.smartgwt.client.util.SC;
      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.grid.ListGrid;
      import com.smartgwt.client.widgets.grid.ListGridField;
      import com.smartgwt.client.widgets.layout.VLayout;
      
      public class MainEntryPoint implements EntryPoint {
         
          public void onModuleLoad() {
      
              DOM.getElementById("loadingPicture").removeFromParent();
              layout();
              SC.showConsole();
          }
         
          private void layout() {
             
              final DataSource ds = new DataSource();
              DataSourceField fieldId = new DataSourceField();
              fieldId.setName("id");
              fieldId.setPrimaryKey(true);
              fieldId.setHidden(true);
              DataSourceTextField fieldCode = new DataSourceTextField();
              fieldCode.setName("code");
              DataSourceTextField fieldDescription = new DataSourceTextField();
              fieldDescription.setName("description");
              ds.setFields(fieldId, fieldCode, fieldDescription);
             
              final ListGrid lg = new ListGrid();
              ListGridField lgfDescription = new ListGridField("description");
              lgfDescription.setCanHilite(false);
              lg.setFields(lgfDescription);
              lg.setDataSource(ds);
      //        lg.editHilites();
             
              Button button = new Button("Edit Hilites");
              button.addClickHandler(new ClickHandler() {
      
                  public void onClick(ClickEvent event) {
                      lg.editHilites();
                  }
              });
             
              VLayout layout = new VLayout();
              layout.addMember(lg);
              layout.addMember(button);
      
              layout.draw();
          }
      }
      Anyway, the point is that "description" field is still available in Hilite Editor even though it is explicite set as:
      Code:
              lgfDescription.setCanHilite(false);
      MichalG
      ps
      In the linked thread you say about setFieldProperties(). I understand this is ListGrid.setFieldProperties() as described in SmartClient documentation (http://www.smartclient.com/docs/10.0...ieldProperties) ?
      But it is not exposed in SGWT docs (http://www.smartclient.com/smartgwte.../ListGrid.html).
      Attached Files

      Comment


        #4
        Thanks for the clear test case. We've applied a patch that should fix this issue as of the 2015-01-22 build.

        Comment


          #5
          Tested against SmartClient Version: v10.0p_2015-02-02/LGPL Development Only (built 2015-02-02) and confirmed as fixed.
          Thank you.
          MichalG

          Comment

          Working...
          X