Announcement

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

    field.editorProperties.setPickListFields() ignored in FilterBuilder

    Hi,
    In the following 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.OperationBinding;
    import com.smartgwt.client.data.fields.DataSourceTextField;
    import com.smartgwt.client.types.DSDataFormat;
    import com.smartgwt.client.types.DSOperationType;
    import com.smartgwt.client.types.DSProtocol;
    import com.smartgwt.client.util.SC;
    import com.smartgwt.client.widgets.form.FilterBuilder;
    import com.smartgwt.client.widgets.form.fields.ComboBoxItem;
    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() {
    
            DataSource employmentDS = new DataSource();
            employmentDS.setID("Employment");
            OperationBinding fetchBinding = new OperationBinding();
            fetchBinding.setOperationType(DSOperationType.FETCH);
            fetchBinding.setDataFormat(DSDataFormat.XML);
            fetchBinding.setDataProtocol(DSProtocol.POSTXML);
            employmentDS.setOperationBindings(fetchBinding);
            employmentDS.setDataURL("Employment.xml");
           
            DataSource departmentDS = new DataSource();
            departmentDS.setID("Department");
            departmentDS.setOperationBindings(fetchBinding);
            departmentDS.setDataURL("Department.xml");
           
            DataSourceField idDepField = new DataSourceField();
            idDepField.setName("id");
            idDepField.setPrimaryKey(true);
            idDepField.setHidden(true);
            DataSourceTextField codeField = new DataSourceTextField();
            codeField.setName("code");
            departmentDS.setFields(idDepField, codeField);
    
            DataSourceField idField = new DataSourceField();
            idField.setName("id");
            idField.setPrimaryKey(true);
            idField.setHidden(true);
            DataSourceField employerField = new DataSourceField();
            employerField.setName("employer");
            employerField.setForeignKey("Department.id");
            employerField.setValueXPath("employer/id");
            ComboBoxItem defaultItem = new ComboBoxItem("employer");
            defaultItem.setOptionDataSource(departmentDS);
            defaultItem.setValueField("id");
            defaultItem.setDisplayField("code");
            [U]defaultItem.setPickListFields(new ListGridField("id"), new ListGridField("code"));[/U]
            [B]employerField.setEditorProperties(defaultItem);[/B]
            employmentDS.setFields(idField, employerField);
    
            FilterBuilder fb = new FilterBuilder();
            fb.setDataSource(employmentDS);
            fb.draw();
        }
       
    }
    using these xml data files:
    Employment.xml
    Code:
    <response>
        <status>STATUS_SUCCESS</status>
        <startRow>0</startRow>
        <endRow>1</endRow>
        <totalRows>2</totalRows>
        <data>
            <Employment>
                <id>20</id>
                <employer>
                    <id>3</id>
                    <code>Microsoft</code>
                </employer>
            </Employment>
            <Employment>
                <id>21</id>
                <employer>
                    <id>4</id>
                    <code>Apple</code>
                </employer>
            </Employment>
        </data>
    </response>
    Department.xml
    Code:
    <response>
        <status>STATUS_SUCCESS</status>
        <startRow>0</startRow>
        <endRow>4</endRow>
        <totalRows>5</totalRows>
        <data>
            <Department>
                <id>1</id>
                <code>Oracle</code>
                <parentId>
                    <id>2</id>
                    <code>Sun</code>
                </parentId>
            </Department>
            <Department>
                <id>2</id>
                <code>Sun</code>
                <parentId>
                    <id>2</id>
                    <code>Sun</code>
                </parentId>
            </Department>
            <Department>
                <id>3</id>
                <code>Microsoft</code>
                <parentId>
                    <id>2</id>
                    <code>Sun</code>
                </parentId>
            </Department>
            <Department>
                <id>4</id>
                <code>Apple</code>
                <parentId>
                    <id>2</id>
                    <code>Sun</code>
                </parentId>
            </Department>
        </data>
    </response>
    Running this test case shows that employer field drop-down list has 2 columns: id and code:
    Click image for larger version

Name:	fb_editorProperties1.png
Views:	90
Size:	268.1 KB
ID:	238493
    This is correct - defaultItem.setPickListFields(new ListGridField("id"), new ListGridField("code"));
    as underlined in test case.
    The problem is that if user changes operator from "eqals" to "not equal", then drop-down list has only 1 column:
    Click image for larger version

Name:	fb_editorProperties2.png
Views:	69
Size:	231.1 KB
ID:	238494
    Also, changing operator to "equals" again, shows only 1 column:
    Click image for larger version

Name:	fb_editorProperties3.png
Views:	58
Size:	242.2 KB
ID:	238495
    This is tested against the most current 6.0p version:
    SmartClient Version: v11.0p_2016-06-07/LGPL Development Only (built 2016-06-07)
    Developer console shows no warning nor errors.
    MichalG

    #2
    Hi,
    Tested against SmartClient Version: v11.0p_2016-07-05/LGPL Development Only (built 2016-07-05)
    and this issue still exists.
    MichalG

    Comment


      #3
      This is fixed for builds dated July 7 and later

      Comment


        #4
        Tested against July 7 build - fixed.
        Thanks,
        MichalG

        Comment

        Working...
        X