Announcement

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

    Advanced Field Picker displays only group values in sample data

    Run the following sample on IE9, Windows 7, SmartGWT 3.1.p2012-11-27. (Firefox 15 seems to behave as expected).

    Group by some column (in this case, Customer Name). Then choose "Columns..." from the grid's context menu. All columns in the chooser display the group value instead of a row/column value. See attachment for visual.

    Code:
    package com.islandpacific.testcase.client;
    
    import com.google.gwt.core.client.EntryPoint;
    import com.google.gwt.core.client.GWT;
    import com.smartgwt.client.core.KeyIdentifier;
    import com.smartgwt.client.data.DataSource;
    import com.smartgwt.client.util.KeyCallback;
    import com.smartgwt.client.util.Page;
    import com.smartgwt.client.util.SC;
    import com.smartgwt.client.widgets.grid.ListGrid;
    import com.smartgwt.client.widgets.grid.ListGridField;
    import com.smartgwt.client.widgets.layout.VLayout;
    
    public final class TestCaseEntryPoint implements EntryPoint {
    
    	public void onModuleLoad() {
    		
    		ListGrid grid = new MyListGrid();
    		
    		grid.setDataSource(DataSource.get("ORDER"));
    		grid.setAutoFetchData(true);
    		grid.setUseAllDataSourceFields(true);
    		
    		ListGridField tracking = new ListGridField("TRACKINGNUMBER");
    		tracking.setAttribute("detail", true);
    		
    		grid.setFields(tracking);
    		
    		VLayout layout = new VLayout();
    		layout.setWidth100();
    		layout.setHeight100();
    		
    		layout.addMember(grid);
    		
    		layout.draw();
    
    		/*
    		 * enable the sgwt debug console in development mode
    		 */
    		if (!GWT.isScript()) {
    			KeyIdentifier debugKey = new KeyIdentifier();
    			debugKey.setCtrlKey(true);
    			debugKey.setAltKey(true);
    			debugKey.setKeyName("D");
    			Page.registerKey(debugKey, new KeyCallback() {
    				public void execute(String keyName) {
    					SC.showConsole();
    				}
    			});
    		}
    
    	}
    
    	class MyListGrid extends ListGrid {
    		public MyListGrid() {
    			setAttribute("useAdvancedFieldPicker", true, false);
    			setAttribute("advancedFieldPickerThreshold", 1, false);
    		}
    	}
    	
    }
    Attached Files

    #2
    I realize this is a pretty trivial issue, but if nothing else at this point, can I get an acknowledgement so that I have something to report?

    Comment


      #3
      We do see the the issue you mention - it affects only the sample values for each column. If you set the sample value yourself before the picker is first opened for that ListGrid, that will work around the issue.

      The AFP is an undocumented feature for 3.1p, but will be fully supported in 4.0d. We have made a fix to the SC 9.0d/SGWT 4.0d branches to address the issue you describe.

      Comment


        #4
        Can I get a hint as to how I would go about setting those sample values, please?

        Comment


          #5
          Since we haven't exposed the SC APIs for this in 3.1p, the Java APIs to do this simply don't exist, so you'd need to define a new ListGrid subclass like:

          Code:
          public class MyListGrid extends ListGrid {
          
              public void installPickerSampleValue(Record record) {
          
                      this.setAttribute("useAdvancedFieldPicker", true, true);
                      this.setAttribute("advancedFieldPickerThreshold", 0, true);
          
                      Record fieldPickerProps  = new Record();
                      fieldPickerProps.setAttribute("sampleRecord", record.getJsObj());
          
                      Record windowProps = new Record();
                      windowProps.setAttribute("fieldPickerProperties", fieldPickerProps.getJsObj());
          
                      this.setAttribute("fieldPickerWindowProperties", windowProps.getJsObj(), true);
              }
          }
          and then use it like:

          Code:
          MyListGrid boundList = new MyListGrid();
          Record sample = new Record();
          sample.setAttribute("continent", "Atlantis");
                                   :
          boundList.installPickerSampleValue(sample);
                                   :
          boundList.draw();
          Last edited by Isomorphic; 4 Dec 2012, 17:53.

          Comment


            #6
            That seems to do the trick. Thanks.

            Comment

            Working...
            X