Announcement

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

    lgf.setFilterEditorProperties() ignored when dsf.setEditorProperties() is set

    Hi,
    In the following DataSourceField "employer" has editorProperties set to a FormItem template with height=50.
    At the same time, ListGridField "employer" has editorProperties set to another template with height=70 and filterEditorProperties set to yet another template with height=22.
    If you run this example you will see that height=22 as set for filter cell is ignored. Instead height=50 (as defined for default DataSourceField editor is used). Ignoring height=22 for field employer makes visible misalignment of other fields in filter editor row (employer_code).
    Although, if you enter ListGrid edit record mode, then you will see that height=70 (as defined for ListGridField editor properties) is correctly used.
    Click image for larger version

Name:	filterHeight1.png
Views:	82
Size:	5.4 KB
ID:	235242
    Commenting out line:
    employerField.setEditorProperties(defaultItem);
    makes filter cell for employer field displayed fine using height=22 as its template suggests.
    Click image for larger version

Name:	filterHeight2.png
Views:	46
Size:	5.4 KB
ID:	235243

    1. SmartClient Version: v10.1p_2016-02-19/LGPL Development Only (built 2016-02-19)
    2. Chrominium 38.0.2125.101 (290379) (64-bit)
    3.
    4.
    5.

    6. Sample code:
    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.fields.TextItem;
    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() {
    
            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");
           
            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");
            TextItem defaultItem = new TextItem("employer");
            defaultItem.setHeight(50);
            employerField.setEditorProperties(defaultItem);
            ListGridField employerListGridField = new ListGridField("employer");
            employerListGridField.setDisplayField("employer_code");
            TextItem editItem = new TextItem("employer");
            editItem.setHeight(70);
            employerListGridField.setEditorProperties(editItem);
            TextItem filterItem = new TextItem("employer");
            filterItem.setHeight(22);
            employerListGridField.setFilterEditorProperties(filterItem);
           
            DataSourceTextField employer_codeField = new DataSourceTextField();
            employer_codeField.setName("employer_code");
            employer_codeField.setValueXPath("employer/code");
            employmentDS.setFields(idField, employerField, employer_codeField);
    
            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);
           
            ListGrid lg = new ListGrid();
            lg.setWidth(300);
            lg.setCanEdit(true);
            lg.setShowFilterEditor(true);
            lg.setAutoSaveEdits(false);
            lg.setFields(employerListGridField);
           
            lg.setDataSource(employmentDS);
            lg.setUseAllDataSourceFields(true);
            lg.fetchData();
           
            lg.draw();
        }
       
    }
    Sample data:
    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>

    #2
    Hi,
    Should I provide any more information in order to get this issue resolved?
    Thanks,
    MichalG

    Comment


      #3
      No, your test case was very clear, thank you. There are just a couple of tricky aspects in terms of what should override what that we are still working through.

      Comment


        #4
        Just to let you know: this issue still occurs in recent SmartClient Version: v11.0p_2016-03-30/LGPL Development Only (built 2016-03-30).
        MichalG

        Comment


          #5
          Tested against SmartClient Version: v11.0p_2016-04-14/LGPL Development Only (built 2016-04-14)
          and it looks like this issue is now resolved.
          Thank you,
          MichalG

          Comment

          Working...
          X